Add streaming method profiling support.
The goal is to allow DDMS to start/stop method profiling in apps that
don't have permission to write to /sdcard. Instead of writing the
profiling data to disk and then pulling it off, we just blast the whole
thing straight from memory.
This includes:
- New method tracing start call (startMethodTracingDdms).
- Rearrangement of existing VMDebug method tracing calls for sanity.
- Addition of "vector" chunk send function, with corresponding
update to the JDWP transport function.
- Reshuffled the method trace start interlock, which seemed racy.
- Post new method-trace-profiling-streaming feature to DDMS.
Also:
- Added an internal exception-throw function that allows a printf
format string, so we can put useful detail into exception messages.
For bug 2160407.
diff --git a/vm/Exception.c b/vm/Exception.c
index 808b0b2..477f16f 100644
--- a/vm/Exception.c
+++ b/vm/Exception.c
@@ -181,6 +181,18 @@
/*
+ * Format the message into a small buffer and pass it along.
+ */
+void dvmThrowExceptionFmtV(const char* exceptionDescriptor, const char* fmt,
+ va_list args)
+{
+ char msgBuf[512];
+
+ vsnprintf(msgBuf, sizeof(msgBuf), fmt, args);
+ dvmThrowChainedException(exceptionDescriptor, msgBuf, NULL);
+}
+
+/*
* Create a Throwable and throw an exception in the current thread (where
* "throwing" just means "set the thread's exception pointer").
*