GDB调试手机工程
挂载自己编译好的工程
以我自己在10.1.6.32编译的工程为例.
sudo mount -t cifs -o username="android",password="mobile#5" //10.1.6.32/android /mnt/10.1.6.32
错误提示:
mount: block device //10.1.6.36/android is write-protected, mounting read-only
mount: cannot mount block device //10.1.6.36/android read-only实际是密码错误:
sudo mount -t cifs -o username="android",password="hipad@123" //10.1.6.36/android /mnt/10.1.6.36
sudo mount -t cifs -o username="android",password="hipad@123" //10.1.6.14/android /mnt/10.1.6.14 |
CIFS文件系统的读写权限
查看用户ID
cat /etc/passwd | grep 你的用户名
参考网址:
https://blog.csdn.net/qq_21808961/article/details/78532487普通用户如何拥有挂载的CIFS文件系统的读写权限:
https://blog.csdn.net/u012487272/article/details/80530473可读写挂载方法:
sudo mount -t cifs -o username="android",password="hipad@123",uid=1000,gid=1000 //10.1.6.14/android /mnt/10.1.6.14
TIPS:
参考文档:
http://www.vixual.net/blog/archives/228
编译gdbserver(或者直接用ndk里面的)
mmm prebuilts/misc/android-arm/gdbserver/ -j8 |
Gdbserver attatch 你要测试的程序
adb shell gdbserver :5039 --attach 2275 (3474 是你要debug的PROCESS PID) |
设置手机端口映射到PC
adb forward tcp:5039 tcp:5039 |
GDB 调试连接
启动GDB
android@NSGWD180021:/mnt/10.1.6.32/black/QS5509QL-black/v1A5Z-black-test_memory_leak$
prebuilts/gdb/linux-x86/bin/gdb
(gdb) set solib-absolute-prefix /mnt/10.1.6.32/black/QS5509QL-black/v1A5Z-black-test_memory_leak/out/target/product/QS5509QL/symbols/
(gdb) set solib-search-path /mnt/10.1.6.32/black/QS5509QL-black/v1A5Z-black-test_memory_leak/out/target/product/QS5509QL/symbols/system/lib/
(gdb) target remote :5039
(gdb) b jpeg_start_decompress
(gdb) b je_malloc if size > 100000 && size != 1336
(gdb) c结果
Thread 40 "Measurement Wor" hit Breakpoint 2, je_malloc (size=120000) at external/jemalloc/src/jemalloc.c:1649 |
参考文档:
https://wladimir-tm4pda.github.io/porting/debugging_gdb.html