c++调试
在NDK调试的时候,如果找不到 符号的话,我们可以在调试配置中添加符号地址的全路径一直到根目录:,xxx/armeabi-v7a:
You must point the symbol search paths at the obj/local/ directory. This is also not a recursive search path, so you must set the full path to the obj/local/armeabi-v7a directory.
NDK调试的过程中,如果debug包也是将so strip的话,可以在build选项中控制不strip
buildTypes {
debug {
packagingOptions {
doNotStrip '**/*.so'
}
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
packagingOptions {
doNotStrip '**/*.so'
}
}
}
如果通过上面的方式 don’t strip 还是无法调试,可以尝试 增加 -g 参数,增加调试信息。
android {
...
buildTypes {
debug {
externalNativeBuild {
cmake {
// 生成调试信息
cppFlags += "-g"
}
}
}
}
报错解决:
如果在NDK debug 调试的时候有下面的报错:
If you experience an application crash at
AInputQueue_preDispatchEvent with SIGILL
(illegal instruction), there is a workaround available by disabling theSIGILL
handler in LLDB. Follow these instructions to do so:
我们可以使用下面的方式去解决:
1. Open the application in Android Studio.
2. Open Run > Edit Configurations.
3. On the Run/Debug Configurations window, make sure your app is selected in the left pane, and click the Debugger tab in the right pane.
On the Debugger tab, click the LLDB Post Attach Commands tab below.
4. Click the + to the right, add the following command, and press Enter:
process handle --pass true --stop false --notify true SIGILL
5. Click OK to apply the change.
perfetto
新的sysTrace工具
https://developer.android.com/studio/command-line/perfetto?hl=zh-cn
反编译工具:
jadx-gui:
方便的jadx工具,可以直接反编译apk
与jd-gui有类似的界面
支持全局搜索
Mapping 设置
打开 Settings 按照下面的方式添加自己的工程路径到项目中,这样我们就可以将项目添加到Android studio 的git 管理工,在代码编辑的地方直接右键 Annotate 可以看到代码提交记录