| Summary: | [disassembly] Address bar does not work for symbols | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Anton Leherbauer <aleherb+eclipse> | ||||||
| Component: | cdt-debug-dsf | Assignee: | Patrick Chuong <pchuong> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Pawel Piech <pawel.1.piech> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cdtdoug, pchuong | ||||||
| Version: | 8.0 | Flags: | pchuong:
iplog-
|
||||||
| Target Milestone: | 8.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 182630 [details]
fix
Anton, can you please review the change? (In reply to comment #2) > Anton, can you please review the change? The patch simply ignores the exception, but the issue is that navigating to 'main' and other symbols did work before. JumpToAddressAction should use gotoSymbol(). That's what it is meant for. I need to remember the address in the combo box, do you have any suggestion how I can evaluate the expression ahead of time before calling gotoSymbol()? can I evaluate for "symbol", if that returns an address, than use the address. Otherwise, evaluate "&symbol"? (In reply to comment #4) > I need to remember the address in the combo box, do you have any suggestion how > I can evaluate the expression ahead of time before calling gotoSymbol()? I guess this requires to extend the IDisassemblyBackend interface, e.g. gotoSymbol() could be split into evaluateSymbolAddress() and gotoAddress(). I can modify the IDisassemblyBackend interface like you suggested and change both cdi and dsf implementations.
There is another way around without changing the IDisassemblyBackend interface, by changing the eval(String expr) in DisassemblyPart to:
public BigInteger eval(String expr) {
String location = evaluateExpression(expr);
BigInteger result = getExpressionResult(location);
if (result == PC_UNKNOWN) {
location = evaluateExpression("&" + expr); //$NON-NLS-1$
result = getExpressionResult(location);
}
return result;
}
Can you let me know which way you think it works better?
Splitting up the gotoSymbol() is more flexibile and relies on the backend to evaluate the expression. However, this also means that IDisassemblyPartCallback interface needs to be extended to provide callback API for the backend to notify the DisassemblyPart the expression is evaluated.
Modifying the eval API has less code change, but relies on the the client's knowledge of evalauting the expression, if failed, than evaluate the address of the expression.
The return value of IDisassemblyBackend.evaluateExpression() is just a string and its Javadoc says "Evaluate an expression for text hover", i.e. the returned string can be any text. There is no guarantee that the returned string can be translated into an address. Therefore enhancing IDisassemblyBackend is the only solution. Created attachment 182855 [details]
evaluateSymbolAddress() API patch
New evaluateSymbolAddress() API for IDisassemblyBackend, implemented for both dsf backend and cdi backend.
Looks good. Please externalize the error message "Symbol does not evaluate to an address...". I'd suggest to use the word "Location" or "Expression" instead of "Symbol". The message key DisassemblyMessages.Disassembly_GotoAddressDialog_error_invalid_address is no longer used, we should remove it. Feel free to commit if you already have the rights. Thanks! Anton, I have committed the patch to CVS with the additional suggested changes in your last comment. Can you verify and close the bug? Thanks! This is my first CVS commit, hope I didn't cause any trouble. :) *** cdt cvs genie on behalf of pchuong *** Bug 329682 - [disassembly] Address bar does not work for symbols [*] DisassemblyMessages.java 1.10 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java?root=Tools_Project&r1=1.9&r2=1.10 [*] DisassemblyMessages.properties 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties?root=Tools_Project&r1=1.8&r2=1.9 [*] DisassemblyBackendDsf.java 1.16 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java?root=Tools_Project&r1=1.15&r2=1.16 [*] DisassemblyPart.java 1.36 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java?root=Tools_Project&r1=1.35&r2=1.36 [*] AddressBarContributionItem.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java?root=Tools_Project&r1=1.2&r2=1.3 [*] JumpToAddressAction.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java?root=Tools_Project&r1=1.4&r2=1.5 [*] IDisassemblyBackend.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java?root=Tools_Project&r1=1.2&r2=1.3 [*] DisassemblyBackendCdi.java 1.13 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java?root=Tools_Project&r1=1.12&r2=1.13 (In reply to comment #10) > Anton, I have committed the patch to CVS with the additional suggested changes > in your last comment. Can you verify and close the bug? Thanks! > > This is my first CVS commit, hope I didn't cause any trouble. :) No complaints :) I did realize that this would break the current version of TCFDisassemblyBackend, but I did not realize that would break the nightly CDT build. I made the change backwards compatible by introducing an abstract implementation of IDisassemblyBackend. *** cdt cvs genie on behalf of aleherbau *** Bug 329682 - Restore backwards compatibility [*] IDisassemblyBackend.java 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java?root=Tools_Project&r1=1.3&r2=1.4 [*] DisassemblyBackendCdi.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java?root=Tools_Project&r1=1.13&r2=1.14 [+] AbstractDisassemblyBackend.java http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java?root=Tools_Project&revision=1.1&view=markup [*] DisassemblyBackendDsf.java 1.17 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java?root=Tools_Project&r1=1.16&r2=1.17 [*] DisassemblyPart.java 1.38 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java?root=Tools_Project&r1=1.37&r2=1.38 *** cdt cvs genie on behalf of aleherbau *** Bug 329682 - Rename method "evaluateSymbolAddress" to "evaluateAddressExpression" [*] IDisassemblyBackend.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java?root=Tools_Project&r1=1.4&r2=1.5 [*] DisassemblyBackendCdi.java 1.15 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java?root=Tools_Project&r1=1.14&r2=1.15 [*] AbstractDisassemblyBackend.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java?root=Tools_Project&r1=1.1&r2=1.2 [*] DisassemblyBackendDsf.java 1.18 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java?root=Tools_Project&r1=1.17&r2=1.18 [*] DisassemblyPart.java 1.39 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java?root=Tools_Project&r1=1.38&r2=1.39 |
Entering 'main' in the address bar gives following exception (with DSF-GDB): java.lang.NumberFormatException: For input string: "{int" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at java.math.BigInteger.<init>(BigInteger.java:316) at java.math.BigInteger.<init>(BigInteger.java:451) at org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils.decodeAddress(DisassemblyUtils.java:51) at org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart.eval(DisassemblyPart.java:2953) at org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.JumpToAddressAction.run(JumpToAddressAction.java:45) This seems to be caused by the changes for bug 326670. Patrick, could you take a look?