1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 442394 - Sometimes breakpoints set and immediately deleted when

debugging with GDB

Change-Id: I4cdc2bfc50ce846fc3175e633b2d27510ba65e82
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/33458
Tested-by: Hudson CI
Reviewed-by: Alvaro Sanchez-Leon <alvsan09@gmail.com>
This commit is contained in:
Marc Khouzam 2014-09-16 12:21:06 -04:00
parent c5d3f2247d
commit cee8719e10
8 changed files with 41 additions and 24 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 4.5.0.qualifier Bundle-Version: 4.6.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>4.5.0-SNAPSHOT</version> <version>4.6.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.dsf.gdb</artifactId> <artifactId>org.eclipse.cdt.dsf.gdb</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.dsf.concurrent.ReflectionSequence;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext; import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
@ -438,8 +437,7 @@ public class DebugNewProcessSequence extends ReflectionSequence {
public void stepStartTrackingBreakpoints(RequestMonitor rm) { public void stepStartTrackingBreakpoints(RequestMonitor rm) {
if (fBackend.getSessionType() != SessionType.CORE) { if (fBackend.getSessionType() != SessionType.CORE) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class); bpmService.startTrackingBpForProcess(getContainerContext(), rm);
bpmService.startTrackingBreakpoints(bpTargetDmc, rm);
} else { } else {
rm.done(); rm.done();
} }

View file

@ -271,8 +271,8 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
@Override @Override
public void execute(RequestMonitor trackBpRm) { public void execute(RequestMonitor trackBpRm) {
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(ctx, IBreakpointsTargetDMContext.class); IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class);
bpmService.startTrackingBreakpoints(bpTargetDmc, trackBpRm); bpmService.startTrackingBpForProcess(containerDmc, trackBpRm);
}; };
} }
}; };

View file

@ -928,8 +928,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
public void execute(RequestMonitor rm) { public void execute(RequestMonitor rm) {
// Start tracking breakpoints. // Start tracking breakpoints.
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class); bpmService.startTrackingBpForProcess(fContainerDmc, rm);
bpmService.startTrackingBreakpoints(bpTargetDmc, rm);
} }
}, },
// Turn on reverse debugging if it was enabled as a launch option // Turn on reverse debugging if it was enabled as a launch option

View file

@ -331,8 +331,7 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
@Override @Override
public void execute(RequestMonitor rm) { public void execute(RequestMonitor rm) {
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(fContainerDmc, IBreakpointsTargetDMContext.class); bpmService.startTrackingBpForProcess(fContainerDmc, rm);
bpmService.startTrackingBreakpoints(bpTargetDmc, rm);
} }
}, },
// Turn on reverse debugging if it was enabled as a launch option // Turn on reverse debugging if it was enabled as a launch option

View file

@ -346,6 +346,38 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// IBreakpointsManager // IBreakpointsManager
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/**
* Wrapper around startTrackingBreakpoints() which accepts a containerDmc and sets
* each breakpoints filter to include that container. This method should be called
* instead of startTrackingBreakpoints()
*
* @param containerDmc The container to be added in the bp filter. This container
* must have the proper IBreakpointsTargetDMContext in its hierarchy.
*
* @since 4.6
*/
public void startTrackingBpForProcess(final IContainerDMContext containerDmc, final RequestMonitor rm) {
final IBreakpointsTargetDMContext targetBpDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
startTrackingBreakpoints(targetBpDmc, new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
final Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformBPs.get(targetBpDmc);
if (platformBPs == null) {
assert false;
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Missing bp target context", null)); //$NON-NLS-1$
return;
}
for (final ICBreakpoint breakpoint : platformBPs.keySet()) {
setTargetFilter(breakpoint, containerDmc);
}
rm.done();
}
});
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// startTrackingBreakpoints // startTrackingBreakpoints
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -1480,15 +1512,6 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/ */
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IStartedDMEvent e) { public void eventDispatched(IStartedDMEvent e) {
if (e.getDMContext() instanceof IContainerDMContext) {
// Process started, add it to the thread filtering of all breakpoints
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(fDebugModelId);
for (IBreakpoint bp : allBreakpoints) {
if (supportsBreakpoint(bp)) {
setTargetFilter((ICBreakpoint)bp, (IContainerDMContext)e.getDMContext());
}
}
}
} }
@ -1499,7 +1522,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// Do this only if there wasn't already an entry, or else we would // Do this only if there wasn't already an entry, or else we would
// erase the content of that previous entry. // erase the content of that previous entry.
// This could theoretically happen if the targetFilter is set by // This could theoretically happen if the targetFilter is set by
// someone else, before the IStartedDMEvent arrives indicating a new process. // someone else, before this method is called.
// Bug 433339 // Bug 433339
filterExt.setTargetFilter(containerDmc); filterExt.setTargetFilter(containerDmc);
} }

View file

@ -46,7 +46,6 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress; import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext; import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext;
import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence; import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
@ -533,8 +532,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
@Execute @Execute
public void stepStartTrackingBreakpoints(final RequestMonitor rm) { public void stepStartTrackingBreakpoints(final RequestMonitor rm) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class); bpmService.startTrackingBpForProcess(getContainerContext(), rm);
bpmService.startTrackingBreakpoints(bpTargetDmc, rm);
} }
/* /*