Rearrange JDWP cleanup.
This moves the "get rid of the breakpoints" part before the "tell the
rest of the VM that there's no debugger attached" part. Hitting a
breakpoint when there's no debugger attached is not expected.
For bug 2461667.
diff --git a/vm/jdwp/JdwpMain.c b/vm/jdwp/JdwpMain.c
index 540259d..ef24618 100644
--- a/vm/jdwp/JdwpMain.c
+++ b/vm/jdwp/JdwpMain.c
@@ -148,7 +148,8 @@
/*
* Reset all session-related state. There should not be an active connection
- * to the client at this point (we may be listening for a new one though).
+ * to the client at this point. The rest of the VM still thinks there is
+ * a debugger attached.
*
* This includes freeing up the debugger event list.
*/
@@ -318,14 +319,15 @@
dvmDbgThreadWaiting();
}
- /* interpreter can ignore breakpoints */
+ /* release session state, e.g. remove breakpoint instructions */
+ dvmJdwpResetState(state);
+
+ /* tell the interpreter that the debugger is no longer around */
dvmDbgDisconnected();
- /* if we had stuff suspended, resume it now */
+ /* if we had threads suspended, resume them now */
dvmUndoDebuggerSuspensions();
- dvmJdwpResetState(state);
-
/* if we connected out, this was a one-shot deal */
if (!state->params.server)
state->run = false;