Skip to main content
diff options
authorSimeon Andreev2018-08-31 14:23:52 +0000
committerAndrey Loskutov2018-09-14 07:45:18 +0000
commit21627463815dbdf98047146e270c61e780075ac8 (patch)
parent927fcf00cd9a746968c4e8a2d2f29ecfd6a2e937 (diff)
Bug 537903 - Wrong Debug View due to evaluation on debug context change
Whenever an evaluation runs during thread suspend handling, its possible to create a delta which selects the suspended thread but not its first stack frame. This results due to very specific interleaving of thread running state and code in ThreadEventHandler.fireDeltaUpdatingSelectedFrame(). An evaluation can e.g. be triggered by a job in client code, either with IJavaThread.runEvaluation() or with IJavaObject.sendMessage() methods. No synchronization is possible between those methods and the suspend handling, since such synchronization can block debug event processing and so potentially lead to deadlocks. This change attempts to salvage the situation, after the bad case is encountered. If no top stack frame could be retrieved by ThreadEventHandler.fireDeltaUpdatingSelectedFrame(), but the thread is in suspended state, we query the top stack frame again. In case one evaluation ran in parallel with the suspend handling, at this point we know for sure that the evaluation is done and so the top stack frame is accessible. This change does not help in case client code bombards the thread with evaluations. It also does not help in case an evaluation ran throughout the entire thread suspend handling. Change-Id: I34252c0dac3d031bbbefc3a1328175cab0793ae5 Signed-off-by: Simeon Andreev <>
1 files changed, 12 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/
index a67ca97c3..602f6ae01 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/
@@ -266,8 +266,18 @@ public class ThreadEventHandler extends DebugEventHandler {
if (isEqual(frame, prev)) {
if (frame == null) {
if (thread.isSuspended()) {
- // no frames, but suspended - update & select
- node = node.addNode(thread, threadIndex, flags | IModelDelta.STATE | IModelDelta.SELECT, childCount);
+ // try retrieving the top frame again, in case we ran into an evaluation earlier
+ try {
+ frame = thread.getTopStackFrame();
+ } catch (DebugException e) {
+ }
+ if (frame == null) {
+ // no frames, but suspended - update & select
+ int threadNodeFlags = flags | IModelDelta.STATE | IModelDelta.SELECT;
+ node = node.addNode(thread, threadIndex, threadNodeFlags, childCount);
+ } else {
+ node = node.addNode(thread, threadIndex, flags, childCount);
+ }
} else {
node = node.addNode(thread, threadIndex, flags, childCount);

Back to the top