diff options
author | Marc Khouzam | 2011-05-13 15:01:50 +0000 |
---|---|---|
committer | Marc Khouzam | 2011-05-13 15:01:50 +0000 |
commit | f0be94ea01a98979ba1c8816bbd24bfb36dac2f8 (patch) | |
tree | 51beba11d8c84a939032127c5369f99dc58e60da /dsf-gdb/org.eclipse.cdt.dsf.gdb | |
parent | e2e514ace6c517e57c5c2bd9cfb4efb4e836607f (diff) | |
download | org.eclipse.cdt-f0be94ea01a98979ba1c8816bbd24bfb36dac2f8.tar.gz org.eclipse.cdt-f0be94ea01a98979ba1c8816bbd24bfb36dac2f8.tar.xz org.eclipse.cdt-f0be94ea01a98979ba1c8816bbd24bfb36dac2f8.zip |
Bug 339456: Thread created event with wrong id after restart for GDB < 7.0
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb')
-rw-r--r-- | dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java index 22f59702224..c7185e882e1 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java @@ -21,6 +21,7 @@ import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent; import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; @@ -42,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadCreatedEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIConsoleStreamOutput; import org.eclipse.cdt.dsf.mi.service.command.output.MIOOBRecord; import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; +import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; import org.eclipse.cdt.dsf.service.DsfServicesTracker; /** @@ -55,7 +57,7 @@ public class CLIEventProcessor private final ICommandControlDMContext fControlDmc; // Last Thread ID created - private static int fLastThreadId; + private int fLastThreadId; private final DsfServicesTracker fServicesTracker; @@ -68,11 +70,12 @@ public class CLIEventProcessor fServicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fCommandControl.getSession().getId()); connection.addCommandListener(this); connection.addEventListener(this); - // Re-set the counter - fLastThreadId = 0; + + fCommandControl.getSession().addServiceEventListener(this, null); } public void dispose() { + fCommandControl.getSession().removeServiceEventListener(this); fCommandControl.removeCommandListener(this); fCommandControl.removeEventListener(this); fServicesTracker.dispose(); @@ -129,17 +132,6 @@ public class CLIEventProcessor } } - // Look for an event that indicates a start/restart. This will tell use - // we should reset our thread number counter - // The printout that seems to occur on restarts (and start) is - // [Thread debugging using libthread_db enabled] - // Bug 339456 - pattern = Pattern.compile("^\\[Thread debugging using "); //$NON-NLS-1$ - matcher = pattern.matcher(exec.getCString()); - if (matcher.find()) { - fLastThreadId = 0; - } - // For GDB thread exit events, we won't use the events generated by GDB. This event is // raised in GDBRunControl class by polling and comparing the ExecutionContexts returned by // -thread-list-ids command. This is done as threads reported by exit event are still reported till @@ -371,4 +363,14 @@ public class CLIEventProcessor return (operation.startsWith("det") && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$ } + /** @since 4.0 */ + @DsfServiceEventHandler + public void eventDispatched(IStartedDMEvent e) { + if (e.getDMContext() instanceof IContainerDMContext) { + // If a process restarts, we must reset the thread id + // No need to worry about multi-process in this version. + fLastThreadId = 0; + } + } + } |