mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 155464: Thread mix-up when debugging multi-threaded programs.
This commit is contained in:
parent
8352714872
commit
6a3d9e2e9e
1 changed files with 15 additions and 0 deletions
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue