OSDN Git Service

Properly set the entry point for the dbg > mterp transition.
authorBen Cheng <bccheng@android.com>
Fri, 2 Jul 2010 20:00:39 +0000 (13:00 -0700)
committerBen Cheng <bccheng@android.com>
Fri, 2 Jul 2010 20:00:39 +0000 (13:00 -0700)
Bug: 2810533
Change-Id: I511543a9ae3ea3abc358a7982c0e5b4ab79bf58a

vm/interp/Jit.c

index e920cfc..0665dcd 100644 (file)
@@ -659,6 +659,14 @@ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState)
     int switchInterp = false;
     bool debugOrProfile = dvmDebuggerOrProfilerActive();
 
+    /*
+     * Bug 2710533 - dalvik crash when disconnecting debugger
+     *
+     * Reset the entry point to the default value. If needed it will be set to a
+     * specific value in the corresponding case statement (eg kJitSingleStepEnd)
+     */
+    interpState->entryPoint = kInterpEntryInstr;
+
     /* Prepare to handle last PC and stage the current PC */
     const u2 *lastPC = interpState->lastPC;
     interpState->lastPC = pc;
@@ -836,16 +844,8 @@ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState)
             }
             break;
 #endif
-        /*
-         * If the debug interpreter was entered for non-JIT reasons, check if
-         * the original reason still holds. If not, we have to force the
-         * interpreter switch here and use dvmDebuggerOrProfilerActive instead
-         * of dvmJitDebuggerOrProfilerActive since the latter will alwasy
-         * return true when the debugger/profiler is already detached and the
-         * JIT profiling table is restored.
-         */
         case kJitNot:
-            switchInterp = !dvmDebuggerOrProfilerActive();
+            switchInterp = !debugOrProfile;
             break;
         default:
             LOGE("Unexpected JIT state: %d entry point: %d",