*/
public static native boolean cacheRegisterMap(String classAndMethodDesc);
- /* don't ask */
- static native void printThis(Object thisThing, int count, int thing);
+ /**
+ * Crashes the VM. Seriously. Dumps the stack trace for the current
+ * thread and then aborts the VM so you can see the native stack trace.
+ * Useful for figuring out how you got somewhere when lots of native
+ * code is involved.
+ *
+ * @hide
+ */
+ public static native void crash();
/*
* Fake method, inserted into dmtrace output when the garbage collector
RETURN_BOOLEAN(result);
}
+/*
+ * static void crash()
+ *
+ * Dump the current thread's interpreted stack and abort the VM. Useful
+ * for seeing both interpreted and native stack traces.
+ *
+ * (Might want to restrict this to debuggable processes as a security
+ * measure, or check SecurityManager.checkExit().)
+ */
+static void Dalvik_dalvik_system_VMDebug_crash(const u4* args,
+ JValue* pResult)
+{
+ UNUSED_PARAMETER(args);
+ UNUSED_PARAMETER(pResult);
+
+ LOGW("Crashing VM on request\n");
+ dvmDumpThread(dvmThreadSelf(), false);
+ dvmAbort();
+}
+
const DalvikNativeMethod dvm_dalvik_system_VMDebug[] = {
{ "getAllocCount", "(I)I",
Dalvik_dalvik_system_VMDebug_getAllocCount },
{ "resetAllocCount", "(I)V",
Dalvik_dalvik_system_VMDebug_resetAllocCount },
- //{ "print", "(Ljava/lang/String;)V",
- // Dalvik_dalvik_system_VMDebug_print },
{ "startAllocCounting", "()V",
Dalvik_dalvik_system_VMDebug_startAllocCounting },
{ "stopAllocCounting", "()V",
Dalvik_dalvik_system_VMDebug_dumpHprofData },
{ "cacheRegisterMap", "(Ljava/lang/String;)Z",
Dalvik_dalvik_system_VMDebug_cacheRegisterMap },
+ { "crash", "()V",
+ Dalvik_dalvik_system_VMDebug_crash },
{ NULL, NULL, NULL },
};