1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +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

@ -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.

View file

@ -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) {