Implement a bit more debugger functionality.
This fixes the deadlock by making SuspendSelfForDebugger not take the thread
list lock, making it more like the equivalent code in dalvikvm.
There's also some code cleanup, and a few more of the JDWP calls jdb makes
on startup. By fixing the deadlock, attaching jdb now causes us to hit
unimplemented code relating to thread stacks. That's tomorrow's job...
Change-Id: I7eac1b95946228fa60666587ff8766bcabb28bb1
diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h
index 6f9625f..41d8d8f 100644
--- a/src/jdwp/jdwp.h
+++ b/src/jdwp/jdwp.h
@@ -98,6 +98,7 @@
struct JdwpNetState;
struct JdwpReqHeader;
struct JdwpTransport;
+struct ModBasket;
/*
* State for JDWP functions.
@@ -235,9 +236,33 @@
void Run();
+ /*
+ * Register an event by adding it to the event list.
+ *
+ * "*pEvent" must be storage allocated with jdwpEventAlloc(). The caller
+ * may discard its pointer after calling this.
+ */
+ JdwpError RegisterEvent(JdwpEvent* pEvent);
+
+ /*
+ * Unregister an event, given the requestId.
+ */
+ void UnregisterEventById(uint32_t requestId);
+
+ /*
+ * Unregister all events.
+ */
+ void UnregisterAll();
+
private:
JdwpState(const JdwpOptions* options);
+ bool InvokeInProgress();
bool IsConnected();
+ void SuspendByPolicy(JdwpSuspendPolicy suspendPolicy);
+ void CleanupMatchList(JdwpEvent** matchList, int matchCount);
+ void EventFinish(ExpandBuf* pReq);
+ void FindMatchingEvents(JdwpEventKind eventKind, ModBasket* basket, JdwpEvent** matchList, int* pMatchCount);
+ void UnregisterEvent(JdwpEvent* pEvent);
public: // TODO: fix privacy
const JdwpOptions* options_;