diff options
author | Francois Chouinard | 2009-01-19 22:36:56 +0000 |
---|---|---|
committer | Francois Chouinard | 2009-01-19 22:36:56 +0000 |
commit | 7477e61a48a1039a605683fc40756f30524c0eb5 (patch) | |
tree | 79421c5cb69fac8ab22cd91415d1ac3567bc8922 /dsf-gdb | |
parent | 7812c51d4d7f7d1537c5fe2237d1bcdb18102a2b (diff) | |
download | org.eclipse.cdt-7477e61a48a1039a605683fc40756f30524c0eb5.tar.gz org.eclipse.cdt-7477e61a48a1039a605683fc40756f30524c0eb5.tar.xz org.eclipse.cdt-7477e61a48a1039a605683fc40756f30524c0eb5.zip |
Fix for bug261082
Diffstat (limited to 'dsf-gdb')
2 files changed, 42 insertions, 15 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java index 5f626fa578d..8fe7ab6e89c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java @@ -64,9 +64,9 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints // General markers public static final String BREAKPOINT_TYPE = PREFIX + ".type"; //$NON-NLS-1$ - public static final String BREAKPOINT = "breakpoint"; //$NON-NLS-1$ - public static final String WATCHPOINT = "watchpoint"; //$NON-NLS-1$ - public static final String CATCHPOINT = "catchpoint"; //$NON-NLS-1$ + public static final String BREAKPOINT = "breakpoint"; //$NON-NLS-1$ + public static final String WATCHPOINT = "watchpoint"; //$NON-NLS-1$ + public static final String CATCHPOINT = "catchpoint"; //$NON-NLS-1$ // Basic set of breakpoint attribute markers public static final String FILE_NAME = PREFIX + ".fileName"; //$NON-NLS-1$ @@ -82,7 +82,6 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public static final String READ = PREFIX + ".read"; //$NON-NLS-1$ public static final String WRITE = PREFIX + ".write"; //$NON-NLS-1$ - // Services ICommandControl fConnection; @@ -101,6 +100,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints final String WATCHPOINT_INSERTION_FAILURE = "Watchpoint insertion failure"; //$NON-NLS-1$ final String INVALID_CONDITION = "Invalid condition"; //$NON-NLS-1$ + /////////////////////////////////////////////////////////////////////////// // Breakpoint Events /////////////////////////////////////////////////////////////////////////// @@ -498,8 +498,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints } // Extract the relevant parameters (providing default values to avoid potential NPEs) - String location = formatLocation(attributes); - + String location = formatLocation(attributes); if (location.equals(NULL_STRING)) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); drm.done(); @@ -868,7 +867,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints } // In case of error (new condition could not be installed for whatever reason), - // GDB "offers" different behaviors depending on its version: it can either keep + // GDB "offers" different behaviours depending on its version: it can either keep // the original condition (the right thing to do) or keep the invalid condition. // Our sole option is to remove the condition in case of error and rely on the // upper layer to re-install the right condition. diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index cdebdd9a1ee..9cf21d0b5ed 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -96,9 +96,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$ // Extra breakpoint attributes - private static final String ATTR_DEBUGGER_PATH = GdbPlugin.PLUGIN_ID + ".debuggerPath"; //$NON-NLS-1$ - private static final String ATTR_THREAD_FILTER = GdbPlugin.PLUGIN_ID + ".threadFilter"; //$NON-NLS-1$ - private static final String ATTR_THREAD_ID = GdbPlugin.PLUGIN_ID + ".threadID"; //$NON-NLS-1$ + private static final String ATTR_DEBUGGER_PATH = GdbPlugin.PLUGIN_ID + ".debuggerPath"; //$NON-NLS-1$ + private static final String ATTR_THREAD_FILTER = GdbPlugin.PLUGIN_ID + ".threadFilter"; //$NON-NLS-1$ + private static final String ATTR_THREAD_ID = GdbPlugin.PLUGIN_ID + ".threadID"; //$NON-NLS-1$ // Services ICommandControl fConnection; @@ -415,7 +415,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), countingRm) { @Override protected void handleSuccess() { - installBreakpoint(dmc, breakpoint, attributes, new RequestMonitor(getExecutor(), countingRm)); + // Install only if the breakpoint is enabled at startup (Bug261082) + boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) && fBreakpointManager.isEnabled(); + if (bpEnabled) + installBreakpoint(dmc, breakpoint, attributes, new RequestMonitor(getExecutor(), countingRm)); + else + countingRm.done(); } }); } @@ -570,8 +575,10 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo thrds.add(thread); threadsIDs.put(breakpoint, thrds); + // Reset the thread (is it necessary?) + attributes.put(ATTR_THREAD_ID, NULL_STRING); + // Finally, update the platform breakpoint - attributes.remove(ATTR_THREAD_ID); try { breakpoint.incrementInstallCount(); } catch (CoreException e) { @@ -753,12 +760,33 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo assert threadsIDs != null; // Minimal validation - if (!platformBPs.containsKey(breakpoint) || !breakpointIDs.containsKey(breakpoint) || !targetBPs.containsValue(breakpoint)) { - rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, BREAKPOINT_NOT_INSTALLED, null)); + if (!platformBPs.containsKey(breakpoint)) { + rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, UNKNOWN_BREAKPOINT, null)); rm.done(); return; } + // Check if the breakpoint is installed: it might not have been if it wasn't enabled at startup (Bug261082) + if (!breakpointIDs.containsKey(breakpoint) && !targetBPs.containsValue(breakpoint)) { + // Install only if the breakpoint is enabled + boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) && fBreakpointManager.isEnabled(); + if (bpEnabled) { + attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING); + attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, breakpoint)); + attributes.put(ATTR_THREAD_ID, NULL_STRING); + determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), rm) { + @Override + protected void handleSuccess() { + installBreakpoint(dmc, breakpoint, attributes, new RequestMonitor(getExecutor(), rm)); + } + }); + } + else { + rm.done(); + } + return; + } + // Get the original breakpoint attributes final Map<String,Object> original_attributes = platformBPs.get(breakpoint); if (original_attributes == null) { @@ -801,7 +829,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // - Install the updated breakpoint // - In the operation succeeded // - Remove the old breakpoint(s) - // - perform any pending update + // - Perform any pending update // Update completion monitor final CountingRequestMonitor updateRM = new CountingRequestMonitor(getExecutor(), rm) { |