[hg] main-silver: #202813: When we happen to have the stack fram...

  • From:
  • To:
  • Subject: [hg] main-silver: #202813: When we happen to have the stack fram...
  • Date: Thu, 20 Sep 2012 19:49:23 -0700

changeset ac1ba4273d76 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/ac1ba4273d76
description:
        #202813: When we happen to have the stack frames invalidated in 
between, try again.

diffstat:

 debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java 
|  22 +++++++--
 1 files changed, 17 insertions(+), 5 deletions(-)

diffs (43 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/TreeEvaluator.java
@@ -115,10 +115,22 @@
     {
         //StackFrame frame = evaluationContext.getFrame();
         ThreadReference frameThread = 
StackFrameWrapper.thread(evaluationContext.getFrame());
-        int frameIndex;
+        int frameIndex = -1;
         try {
-            StackFrame currentFrame = evaluationContext.getFrame();
+            StackFrame currentFrame;
+            int numTries = 100; // Not nice at all, but what can we do when 
we're randomly invalidated?
+            do {
+                currentFrame = evaluationContext.getFrame();
+                try {
             frameIndex = indexOf(ThreadReferenceWrapper.frames(frameThread), 
currentFrame);
+                } catch (InvalidStackFrameExceptionWrapper isfex) {
+                    if (numTries-- > 0) {
+                        continue;
+                    } else {
+                        throw isfex;
+                    }
+                }
+            } while (false);
         } catch (ObjectCollectedExceptionWrapper ocex) {
             throw new InvalidExpressionException(NbBundle.getMessage(
                 TreeEvaluator.class, "CTL_EvalError_collected_context"));
@@ -229,11 +241,11 @@
         //return null;
     }
 
-    private int indexOf(List<StackFrame> frames, StackFrame frame) {
+    private int indexOf(List<StackFrame> frames, StackFrame frame) throws 
InternalExceptionWrapper, VMDisconnectedExceptionWrapper, 
InvalidStackFrameExceptionWrapper {
         int n = frames.size();
-        Location loc = frame.location();
+        Location loc = StackFrameWrapper.location(frame);
         for (int i = 0; i < n; i++) {
-            if (loc.equals(frames.get(i).location())) return i;
+            if (loc.equals(StackFrameWrapper.location(frames.get(i)))) 
return i;
         }
         return -1;
     }

[hg] main-silver: #202813: When we happen to have the stack fram...

mentlicher 09/21/2012

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 51 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close