当捕获到异常时,我们可以调用Throwable.printStackTrace()来转储堆栈跟踪。但我还想将每个帧的参数值转储到堆栈跟踪上。这可以在Android的dalvik JVM上实现吗? 异常堆栈示例:
java.lang.NullPointerException
at com.xxxx.activity.OperationActivity.showError(OperationActivity.java:879)
at com.xxxx.activity.SearchActivity.showList(SearchActivity.java:611)
at com.xxxx.activity.OperationActivity.checkState(OperationActivity.java:756)
at com.xxxx.activity.SearchActivity$14.handleMessage(SearchActivity.java:627)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
我想打印堆栈跟踪上每个帧的所有函数参数值,例如:com.xxxx.activity.OperationActivity.showError()函数的参数值。
非常感谢。