Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-02-02 12:33:47 +0000
committerMikhail Khodjaiants2007-02-02 12:33:47 +0000
commitc13e9b1039151072343562fcfc8a37121b34ebb0 (patch)
treecc68fdbb4948d071745051f643eb51e4f8653461
parente74ea0d9609bc61e916844fe9a958dad518b4e45 (diff)
downloadorg.eclipse.cdt-c13e9b1039151072343562fcfc8a37121b34ebb0.tar.gz
org.eclipse.cdt-c13e9b1039151072343562fcfc8a37121b34ebb0.tar.xz
org.eclipse.cdt-c13e9b1039151072343562fcfc8a37121b34ebb0.zip
Bug 155464: Thread mix-up when debugging multi-threaded programs.
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java
index b614a3af4d..f95a5bc421 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Stefan Bylund (Enea, steby@enea.se) - patch for bug 155464
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
@@ -693,6 +694,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
private void handleResumedEvent( ICDIResumedEvent event ) {
CDebugElementState state = CDebugElementState.RESUMED;
int detail = DebugEvent.RESUME;
+ syncWithBackend();
if ( isCurrent() && event.getType() != ICDIResumedEvent.CONTINUE ) {
preserveStackFrames();
switch( event.getType() ) {
@@ -893,6 +895,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
}
protected void resumedByTarget( int detail, List events ) {
+ syncWithBackend();
if ( isCurrent() && detail != DebugEvent.CLIENT_REQUEST && detail != DebugEvent.UNSPECIFIED ) {
setState( CDebugElementState.STEPPED );
preserveStackFrames();
@@ -933,4 +936,16 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
}
}
}
+
+ private void syncWithBackend() {
+ ICDIThread cdiThread = getCDIThread();
+ ICDIThread currentThread = null;
+ try {
+ currentThread = cdiThread.getTarget().getCurrentThread();
+ }
+ catch( CDIException e ) {
+ // ignore
+ }
+ setCurrent( cdiThread.equals( currentThread ) );
+ }
}

Back to the top