a simple tool to get method stack
为了更好的排查代码运行时问题,打印运行堆栈等信息
//比如app例子中 hook了点击监听中的 clickStack()方法 那么json就写成这样
{
"com.tools.yangpingfrida.MainActivity:clickStack": {
"key": "com.tools.yangpingfrida.MainActivity:clickStack",
"className": "com.tools.yangpingfrida.MainActivity",
"methodName": "clickStack",
"paramCount": 0,
"returnType": "void"
}
}
//如果你想hook framework里面的方法,比如Handler的dispatchMessagen方法
{
"com.tools.yangpingfrida.MainActivity:clickStack": {
"key": "com.tools.yangpingfrida.MainActivity:clickStack",
"className": "com.tools.yangpingfrida.MainActivity",
"methodName": "clickStack",
"paramCount": 0,
"returnType": "void"
},
"android.os.Handler:dispatchMessage": {
"key": "android.os.Handler:dispatchMessage",
"className": "android.os.Handler",
"methodName": "dispatchMessage",
"paramCount": 1,
"returnType": "void"
}
}
1.build.gradle:中添加路径
allprojects{
repositories{
......
flatDir { dirs 'libs' }
}
}
2. add dependence
implementation (name:' printstack-release', ext:'aar')
>>>>>> pid:1379, thread(id:1523, name:frida-stack-worker), timestamp:1642405020522
android.os.Handler.dispatchMessage
java.lang.Exception
at android.os.Handler.dispatchMessage(Native Method)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:65)
<<<<<<
>>>>>> pid:1379, thread(id:1379, name:main), timestamp:1642405020505
com.tools.yangpingfrida.MainActivity.clickStack
java.lang.Exception
at com.tools.yangpingfrida.MainActivity.clickStack(Native Method)
at com.tools.yangpingfrida.MainActivity.lambda$onCreate$0$com-tools-yangpingfrida-MainActivity(MainActivity.java:17)
at com.tools.yangpingfrida.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7360)
at android.widget.TextView.performClick(TextView.java:14234)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
at android.view.View.performClickInternal(View.java:7326)
at android.view.View.access$3200(View.java:849)
at android.view.View$PerformClick.run(View.java:27808)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Handler.dispatchMessage(Native Method)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
<<<<<<
>>>>>> pid:1379, thread(id:1523, name:frida-stack-worker), timestamp:1642405020527
android.os.Handler.dispatchMessage
java.lang.Exception
at android.os.Handler.dispatchMessage(Native Method)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:65)
<<<<<<