1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +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)
* Marc Khouzam (Ericsson) - Workaround for Bug 352998
* 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;
@ -626,29 +627,39 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
/** @since 4.0 */
@DsfServiceEventHandler
@Override
public void eventDispatched(IExitedDMEvent e) {
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
// 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 (!fProcRestarting.remove(dmc)) {
if (fBackend.getSessionType() != SessionType.CORE) {
IBreakpointsTargetDMContext bpTargetDmc = (IBreakpointsTargetDMContext)dmc;
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
if (bpmService != null) {
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
}
});
}
}
}
}
public void eventDispatched(IExitedDMEvent e) {
IDMContext dmc = e.getDMContext();
if (dmc instanceof IContainerDMContext) {
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
// Time to remove the tracking of a restarting process
boolean restarting = fProcRestarting.remove(dmc);
if (bpmService != null) {
if (!restarting) {
// Process exited, remove it from the thread break point filtering
bpmService.removeTargetFilter((IContainerDMContext) dmc);
if (dmc instanceof IBreakpointsTargetDMContext) {
// A process has died, we should stop tracking its breakpoints, but only if it is not restarting
// 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);
}

View file

@ -15,7 +15,8 @@
* Marc Khouzam (Ericsson) - Generalize thread filtering logic (Bug 431986)
* Marc Khouzam (Ericsson) - Accept multiple calls to startTrackingBreakpoints (Bug 389945)
* 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;
@ -1529,18 +1530,23 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/
@DsfServiceEventHandler
public void eventDispatched(IExitedDMEvent e) {
if (e.getDMContext() instanceof IContainerDMContext) {
// 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());
}
}
}
// original code moved to API removeTargetFilter (Bug 456959)
}
/**
* 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) {
try {