Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-02-02 12:51:19 +0000
committerMikhail Khodjaiants2007-02-02 12:51:19 +0000
commit6a3d9e2e9e388fd0958ace994042ba283c06a58d (patch)
tree7a89e75201f919cdd26d670ee5846ff51686b03c /debug
parent8352714872db5fa7c1e5ac69b56cdac6fb1f37be (diff)
downloadorg.eclipse.cdt-6a3d9e2e9e388fd0958ace994042ba283c06a58d.tar.gz
org.eclipse.cdt-6a3d9e2e9e388fd0958ace994042ba283c06a58d.tar.xz
org.eclipse.cdt-6a3d9e2e9e388fd0958ace994042ba283c06a58d.zip
Bug 155464: Thread mix-up when debugging multi-threaded programs.
Diffstat (limited to 'debug')
-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 b614a3af4dc..f95a5bc4216 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