mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Minor additional locking to enhance the safety of the currentThreadID
and to ensure that we are always setting the stack frame initially, even in the case where it is being arbitrarily selected. PR 151253
This commit is contained in:
parent
b4286a0d6e
commit
2f1ea39182
1 changed files with 5 additions and 1 deletions
|
@ -256,6 +256,7 @@ public class Target extends SessionObject implements ICDITarget {
|
|||
// If we use "info threads" in getCThreads() this
|
||||
// will be overwritten. However if we use -stack-list-threads
|
||||
// it does not provide to the current thread
|
||||
lockTarget();
|
||||
currentThreadId = newThreadId;
|
||||
|
||||
// get the new Threads.
|
||||
|
@ -264,6 +265,7 @@ public class Target extends SessionObject implements ICDITarget {
|
|||
} catch (CDIException e) {
|
||||
currentThreads = noThreads;
|
||||
}
|
||||
releaseTarget();
|
||||
|
||||
// Fire CreatedEvent for new threads.
|
||||
// Replace the new threads with the old thread object
|
||||
|
@ -322,6 +324,7 @@ public class Target extends SessionObject implements ICDITarget {
|
|||
public Thread[] getCThreads() throws CDIException {
|
||||
Thread[] cthreads = noThreads;
|
||||
try {
|
||||
lockTarget();
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(false);
|
||||
CommandFactory factory = miSession.getCommandFactory();
|
||||
|
@ -362,7 +365,7 @@ public class Target extends SessionObject implements ICDITarget {
|
|||
// FIX: When attaching there is no thread selected
|
||||
// We will choose the first one as a workaround.
|
||||
if (currentThreadId == 0 && cthreads.length > 0) {
|
||||
currentThreadId = cthreads[0].getId();
|
||||
setCurrentThread(cthreads[0], false);
|
||||
}
|
||||
} catch (MIException e) {
|
||||
// Do not throw anything in this case.
|
||||
|
@ -370,6 +373,7 @@ public class Target extends SessionObject implements ICDITarget {
|
|||
} finally {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
releaseTarget();
|
||||
}
|
||||
return cthreads;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue