1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-05 14:43:36 +02:00

Fix for bug261082

This commit is contained in:
Francois Chouinard 2009-01-19 22:36:56 +00:00
parent 7812c51d4d
commit 7477e61a48
2 changed files with 42 additions and 15 deletions

View file

@ -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 READ = PREFIX + ".read"; //$NON-NLS-1$
public static final String WRITE = PREFIX + ".write"; //$NON-NLS-1$ public static final String WRITE = PREFIX + ".write"; //$NON-NLS-1$
// Services // Services
ICommandControl fConnection; 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 WATCHPOINT_INSERTION_FAILURE = "Watchpoint insertion failure"; //$NON-NLS-1$
final String INVALID_CONDITION = "Invalid condition"; //$NON-NLS-1$ final String INVALID_CONDITION = "Invalid condition"; //$NON-NLS-1$
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Breakpoint Events // Breakpoint Events
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -499,7 +499,6 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints
// Extract the relevant parameters (providing default values to avoid potential NPEs) // Extract the relevant parameters (providing default values to avoid potential NPEs)
String location = formatLocation(attributes); String location = formatLocation(attributes);
if (location.equals(NULL_STRING)) { if (location.equals(NULL_STRING)) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null));
drm.done(); 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), // 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. // 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 // Our sole option is to remove the condition in case of error and rely on the
// upper layer to re-install the right condition. // upper layer to re-install the right condition.

View file

@ -415,7 +415,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), countingRm) { determineDebuggerPath(dmc, attributes, new RequestMonitor(getExecutor(), countingRm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
// 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)); 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); thrds.add(thread);
threadsIDs.put(breakpoint, thrds); threadsIDs.put(breakpoint, thrds);
// Reset the thread (is it necessary?)
attributes.put(ATTR_THREAD_ID, NULL_STRING);
// Finally, update the platform breakpoint // Finally, update the platform breakpoint
attributes.remove(ATTR_THREAD_ID);
try { try {
breakpoint.incrementInstallCount(); breakpoint.incrementInstallCount();
} catch (CoreException e) { } catch (CoreException e) {
@ -753,12 +760,33 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
assert threadsIDs != null; assert threadsIDs != null;
// Minimal validation // Minimal validation
if (!platformBPs.containsKey(breakpoint) || !breakpointIDs.containsKey(breakpoint) || !targetBPs.containsValue(breakpoint)) { if (!platformBPs.containsKey(breakpoint)) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, BREAKPOINT_NOT_INSTALLED, null)); rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, UNKNOWN_BREAKPOINT, null));
rm.done(); rm.done();
return; 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 // Get the original breakpoint attributes
final Map<String,Object> original_attributes = platformBPs.get(breakpoint); final Map<String,Object> original_attributes = platformBPs.get(breakpoint);
if (original_attributes == null) { if (original_attributes == null) {
@ -801,7 +829,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// - Install the updated breakpoint // - Install the updated breakpoint
// - In the operation succeeded // - In the operation succeeded
// - Remove the old breakpoint(s) // - Remove the old breakpoint(s)
// - perform any pending update // - Perform any pending update
// Update completion monitor // Update completion monitor
final CountingRequestMonitor updateRM = new CountingRequestMonitor(getExecutor(), rm) { final CountingRequestMonitor updateRM = new CountingRequestMonitor(getExecutor(), rm) {