Android strace/LLDB 原生native调试等

发布时间 2023-06-29 10:16:45作者: petercao

在 Android 8.0 之前的版本中,崩溃由 debuggerd 和 debuggerd64 守护程序处理。Android 8.0 及更高版本会根据需要生成 crash_dump32 和 crash_dump64。

崩溃转储程序只有在未挂接其他任何工具时才可能挂接。这意味着,使用 strace 或 lldb 等工具会阻碍崩溃转储。


您可以对整个 Tombstone 使用 stack。示例:

stack < FS/data/tombstones/tombstone_05

strace debug
https://source.android.com/docs/core/tests/debug/strace?hl=zh-cn
https://source.android.com/docs/core/tests/debug/gdb?hl=zh-cn

strace的10个命令
https://colobu.com/2021/04/30/strace-commands-for-troubleshooting-and-debugging-linux/

strace 跟踪进程中的系统调用
https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/strace.html

other refs:
https://strace.io/
https://man7.org/linux/man-pages/man1/strace.1.html


refs:
Android 原生程序动态调试(一)(gdb 调试器)
https://blog.csdn.net/zlmm741/article/details/105511833

Android 原生程序动态调试(二)(lldb 调试器)
https://blog.csdn.net/zlmm741/article/details/105538556

Android 原生程序动态调试(三)(使用 IDA Pro 调试 Android 原生程序)
https://blog.csdn.net/zlmm741/article/details/105542150


LLDB调试Android Native程序
https://www.cnblogs.com/ciml/p/14154668.html


LLDB远程调试Android:LLDB命令速查参考手册Handbook
https://juejin.cn/post/7111675932074573861

LLDB debug tutorial
https://lldb.llvm.org/use/tutorial.html

GDB to LLDB command map
https://lldb.llvm.org/use/map.html

Linux 工具参考篇:
1. gdb 调试利器
2. ldd 查看程序依赖库
3. lsof 一切皆文件
4. ps 进程查看器
5. pstack 跟踪进程栈
6. strace 跟踪进程中的系统调用
7. ipcs 查询进程间通信状态
8. top linux下的任务管理器
9. free 查询可用内存
10. vmstat 监视内存使用情况
11. iostat 监视I/O子系统
12. sar 找出系统瓶颈的利器
13. readelf elf文件格式分析
14. objdump 二进制文件分析
15. nm 目标文件格式分析
16. size 查看程序内存映像大小
17. wget 文件下载
18. scp 跨机远程拷贝
19. crontab 定时任务

https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/index.html