Community
Participate
Working Groups
When to set a source line breakpoint, EDC check if the line has code (i.e. it's not a blank line, comment line, etc) by looking up symbol data. If not, it will ask symbol for the next code line and set breakpoint there, namely automatically move the breakpoint to the next line (see bug 323457). That's totally fine. The problem is it uses the API Modules.calcAddressInfo() to get the next code line, which is not designed for the purpose. We need to clean that up by adding new API.
Here's the new API I have. The idea is that when trying to set a breakpoint at a line, if the line has no code then try to set the breakpoint at a line in the close neighborhood (a few lines above and below the line in question) that has code. /** * Given a source line (let's call it anchor), find the line closest to the * anchor in the neighborhood (including the anchor itself) that has machine * code. If the anchor itself has code, it's returned. Otherwise neighbor * lines both above and below the anchor will be checked. If the closest * line above the anchor and the closest line below the anchor have the same * distance from the anchor, the one below will be selected. * * This is mainly used in setting breakpoint at anchor line. * * @param symCtx * the symbol context in which to perform the lookup. It can be * an execution context (e.g. a process), or a module (exe or * dll) in a process. * @param file * the file that contains the source lines in question. * @param anchor * line number of the anchor source line. * @param neighbor_limit * specify the limit of the neighborhood: up to this number of * lines above the anchor and up to this number of lines below * the anchor will be checked if needed. But the check will never * go beyond the source file. When the limit is zero, no neighbor * lines will be checked. If the limit has value of -1, it means * the actual limit is the source file. * @param rm * contains an object of {@link ILineAddresses} if the line with * code is found. And addresses in it are runtime addresses. The * RM will contain error status otherwise. */ public void findClosestLineWithCode(ISymbolDMContext symCtx, String file, int anchor, int neighbor_limit, DataRequestMonitor<ILineAddresses> rm)
Created attachment 190014 [details] patch of implementing the new API in EDC This patch implements the new API in EDC Modules service and in EDC dwarf reader. We may promote the API to DSF in the future if so desired by other DSF debuggers.
Created attachment 190017 [details] Implement the API in EDC Oops, previous patch has a small build error against Indigo and CDT head. Fixed here. Also, the patch moves the breakpoint marker accordingly when the breakpoint is moved to another line in the neighborhood.
Created attachment 190063 [details] unit test for EDC implementation
Committed the patches to EDC head. For test cases, please see bug 323457.
*** cdt cvs genie on behalf of lwang *** Bug 337493 & Bug 323457: new and more complete support of moving breakpoint from no-code line to nearby code line. [*] Modules.java 1.29 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Modules.java?root=Tools_Project&r1=1.28&r2=1.29 [*] BreakpointAttributeTranslator.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/BreakpointAttributeTranslator.java?root=Tools_Project&r1=1.13&r2=1.14 [*] FileLineEntryProvider.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/FileLineEntryProvider.java?root=Tools_Project&r1=1.1&r2=1.2 [*] ModuleLineEntryProvider.java 1.20 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/ModuleLineEntryProvider.java?root=Tools_Project&r1=1.19&r2=1.20 [*] IModuleLineEntryProvider.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/symbols/IModuleLineEntryProvider.java?root=Tools_Project&r1=1.2&r2=1.3 [*] ILineEntryProvider.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/symbols/ILineEntryProvider.java?root=Tools_Project&r1=1.4&r2=1.5 [+] .project http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/resources/Projects/inlineFunction/.project?root=Tools_Project&revision=1.1&view=markup [+] Readme.txt http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/resources/Projects/inlineFunction/Readme.txt?root=Tools_Project&revision=1.1&view=markup [+] .cproject http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/resources/Projects/inlineFunction/.cproject?root=Tools_Project&revision=1.1&view=markup [*] AllEDCTests.java 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/tests/AllEDCTests.java?root=Tools_Project&r1=1.11&r2=1.12 [+] TestFindCodeLine.java http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/tests/TestFindCodeLine.java?root=Tools_Project&revision=1.1&view=markup [+] inlineFunction.exe http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/resources/SymbolFiles/inlineFunction.exe?root=Tools_Project&revision=1.1&view=markup [+] org.eclipse.cdt.managedbuilder.core.prefs http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/edc/org.eclipse.cdt.debug.edc.tests/resources/Projects/inlineFunction/.settings/org.eclipse.cdt.managedbuilder.core.prefs?root=Tools_Project&revision=1.1&view=markup