[hg] main-silver: #213788: Use the event's thread instead of the...

  • From:
  • To:
  • Subject: [hg] main-silver: #213788: Use the event's thread instead of the...
  • Date: Sat, 24 Nov 2012 04:56:04 -0800

changeset b54cf67c8495 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/b54cf67c8495
description:
        #213788: Use the event's thread instead of the step request's thread 
to be sure... Also, check the thread's state.

diffstat:

 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
 |  36 ++++++---
 1 files changed, 23 insertions(+), 13 deletions(-)

diffs (68 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
@@ -365,18 +365,10 @@
         try {
         // TODO: fetch current engine from the Event
         // 1) init info about current state
+        LocatableEvent event = (LocatableEvent) ev;
+        ThreadReference tr = LocatableEventWrapper.thread(event);
         StepRequest sr = (StepRequest) EventWrapper.request(ev);
-        JPDAThreadImpl st = 
getDebuggerImpl().getThread(StepRequestWrapper.thread(sr));
-        st.setInStep(false, null);
-        /*if (stepWatch != null) {
-            stepWatch.done();
-            stepWatch = null;
-        }*/
-        LocatableEvent event = (LocatableEvent) ev;
-        String className = 
ReferenceTypeWrapper.name(LocationWrapper.declaringType(LocatableWrapper.location(event)));
-        ThreadReference tr = LocatableEventWrapper.thread(event);
-        setLastOperation(tr);
-        removeStepRequests (tr);
+        JPDAThreadImpl st = getDebuggerImpl().getThread(tr); // 
StepRequestWrapper.thread(sr));
         Lock lock;
         if (getDebuggerImpl().getSuspend() == 
JPDADebugger.SUSPEND_EVENT_THREAD) {
             lock = st.accessLock.writeLock();
@@ -385,6 +377,14 @@
         }
         lock.lock();
         try {
+            st.setInStep(false, null);
+            /*if (stepWatch != null) {
+                stepWatch.done();
+                stepWatch = null;
+            }*/
+            String className = 
ReferenceTypeWrapper.name(LocationWrapper.declaringType(LocatableWrapper.location(event)));
+            setLastOperation(tr);
+            removeStepRequests (tr);
             //S ystem.out.println("/nStepAction.exec");
 
             int suspendPolicy = getDebuggerImpl().getSuspend();
@@ -393,7 +393,7 @@
             if (isSyntheticLocation) {
                 //S ystem.out.println("In synthetic method -> STEP OVER/OUT 
again");
 
-                int step = StepRequestWrapper.depth((StepRequest) 
EventWrapper.request(ev));
+                int step = StepRequestWrapper.depth(sr);
                 VirtualMachine vm = getDebuggerImpl ().getVirtualMachine ();
                 if (vm == null) {
                     removeBPListener();
@@ -527,7 +527,17 @@
         try {
             loc = 
StackFrameWrapper.location(ThreadReferenceWrapper.frame(tr, 0));
         } catch (IncompatibleThreadStateException itsex) {
-            Exceptions.printStackTrace(itsex);
+            try {
+                int status = ThreadReferenceWrapper.status0(tr);
+                if (!(status == ThreadReference.THREAD_STATUS_UNKNOWN ||
+                    status == ThreadReference.THREAD_STATUS_ZOMBIE ||
+                    status == ThreadReference.THREAD_STATUS_NOT_STARTED)) {
+                    
+                    
Exceptions.printStackTrace(Exceptions.attachMessage(itsex, "Thread's status = 
"+status));
+                }
+            } catch (IllegalThreadStateExceptionWrapper ex) {
+                // A bad state - ignore
+            }
             logger.fine("Incompatible Thread State: 
"+itsex.getLocalizedMessage());
             return true;
         } catch (IllegalThreadStateExceptionWrapper itsex) {

[hg] main-silver: #213788: Use the event's thread instead of the...

mentlicher 11/24/2012

Project Features

About this Project

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