diff options
author | Alvaro Sanchez-Leon | 2015-01-15 19:05:30 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-01-19 21:49:51 +0000 |
commit | 6dda632d25e03805d2278d0cdba54371e169791d (patch) | |
tree | f0c935a95ccb620e65906827484db864551e27b4 | |
parent | 1e441c619d33689a50d613f61cab6344c4f14cb2 (diff) | |
download | org.eclipse.cdt-6dda632d25e03805d2278d0cdba54371e169791d.tar.gz org.eclipse.cdt-6dda632d25e03805d2278d0cdba54371e169791d.tar.xz org.eclipse.cdt-6dda632d25e03805d2278d0cdba54371e169791d.zip |
Bug 456959-Breakpoint Enable does not work after restarting the application
Change-Id: I97e1256a3c718ed653ad255bffe1fa67ae5368c2
2 files changed, 52 insertions, 35 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java index 716e2c3a555..ab6cef33da6 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java @@ -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); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index 3f852986349..08c0c77fc35 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -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 { |