1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00

Bug 456959-Breakpoint Enable does not work after restarting the application

Change-Id: I97e1256a3c718ed653ad255bffe1fa67ae5368c2
This commit is contained in:
Alvaro Sanchez-Leon 2015-01-15 14:05:30 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 1e441c619d
commit 6dda632d25
2 changed files with 52 additions and 35 deletions

View file

@ -9,6 +9,7 @@
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306) * Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* Marc Khouzam (Ericsson) - Workaround for Bug 352998 * Marc Khouzam (Ericsson) - Workaround for Bug 352998
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945) * Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
* Alvaro Sanchez-Leon (Ericsson) - Breakpoint Enable does not work after restarting the application (Bug 456959)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service; package org.eclipse.cdt.dsf.gdb.service;
@ -626,29 +627,39 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
/** @since 4.0 */ /** @since 4.0 */
@DsfServiceEventHandler @DsfServiceEventHandler
@Override @Override
public void eventDispatched(IExitedDMEvent e) { public void eventDispatched(IExitedDMEvent e) {
IDMContext dmc = e.getDMContext(); IDMContext dmc = e.getDMContext();
if (dmc instanceof IBreakpointsTargetDMContext) {
// A process has died, we should stop tracking its breakpoints, but only if it is not restarting if (dmc instanceof IContainerDMContext) {
// We only do this when the process is a breakpointTargetDMC itself (GDB < 7.4); MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
// we don't want to stop tracking breakpoints when breakpoints are only set once
// for all processes (GDB >= 7.4) // Time to remove the tracking of a restarting process
if (!fProcRestarting.remove(dmc)) { boolean restarting = fProcRestarting.remove(dmc);
if (fBackend.getSessionType() != SessionType.CORE) {
IBreakpointsTargetDMContext bpTargetDmc = (IBreakpointsTargetDMContext)dmc; if (bpmService != null) {
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class); if (!restarting) {
if (bpmService != null) { // Process exited, remove it from the thread break point filtering
bpmService.stopTrackingBreakpoints(bpTargetDmc, new ImmediateRequestMonitor() { bpmService.removeTargetFilter((IContainerDMContext) dmc);
@Override
protected void handleCompleted() { if (dmc instanceof IBreakpointsTargetDMContext) {
// Ok, no need to report any error because we may have already shutdown. // A process has died, we should stop tracking its breakpoints, but only if it is not restarting
// We need to override handleCompleted to avoid risking having a error printout in the log // We only do this when the process is a breakpointTargetDMC itself (GDB < 7.4);
} // we don't want to stop tracking breakpoints when breakpoints are only set once
}); // for all processes (GDB >= 7.4)
} if (fBackend.getSessionType() != SessionType.CORE) {
} IBreakpointsTargetDMContext bpTargetDmc = (IBreakpointsTargetDMContext) dmc;
} bpmService.stopTrackingBreakpoints(bpTargetDmc, new ImmediateRequestMonitor() {
} @Override
protected void handleCompleted() {
// Ok, no need to report any error because we may have already shutdown.
// We need to override handleCompleted to avoid risking having a error printout in the log
}
});
}
}
}
}
}
super.eventDispatched(e); super.eventDispatched(e);
} }

View file

@ -15,7 +15,8 @@
* Marc Khouzam (Ericsson) - Generalize thread filtering logic (Bug 431986) * Marc Khouzam (Ericsson) - Generalize thread filtering logic (Bug 431986)
* Marc Khouzam (Ericsson) - Accept multiple calls to startTrackingBreakpoints (Bug 389945) * Marc Khouzam (Ericsson) - Accept multiple calls to startTrackingBreakpoints (Bug 389945)
* Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400628) * Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400628)
* Alvaro Sanchez-Leon (Ericcson) - Sometimes breakpoints set and immediately deleted when debugging with GDB (Bug 442394) * Alvaro Sanchez-Leon (Ericsson) - Sometimes breakpoints set and immediately deleted when debugging with GDB (Bug 442394)
* Alvaro Sanchez-Leon (Ericsson) - Breakpoint Enable does not work after restarting the application (Bug 456959)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service; package org.eclipse.cdt.dsf.mi.service;
@ -1529,18 +1530,23 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/ */
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IExitedDMEvent e) { public void eventDispatched(IExitedDMEvent e) {
if (e.getDMContext() instanceof IContainerDMContext) { // original code moved to API removeTargetFilter (Bug 456959)
// Process exited, remove it from the thread filtering of all breakpoints
// We must get the list of breakpoints from the platform because our different
// maps might already have been cleaned up
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(fDebugModelId);
for (IBreakpoint bp : allBreakpoints) {
if (supportsBreakpoint(bp)) {
removeTargetFilter((ICBreakpoint)bp, (IContainerDMContext)e.getDMContext());
}
}
}
} }
/**
* Remove process from the thread filtering of all breakpoints
* @since 4.6
*/
public void removeTargetFilter(IContainerDMContext containerDMC) {
// We must get the list of breakpoints from the platform because our different
// maps might already have been cleaned up
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(fDebugModelId);
for (IBreakpoint bp : allBreakpoints) {
if (supportsBreakpoint(bp)) {
removeTargetFilter((ICBreakpoint) bp, containerDMC);
}
}
}
private void removeTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) { private void removeTargetFilter(ICBreakpoint breakpoint, IContainerDMContext containerDmc) {
try { try {