android上gdb coredump步骤

本文详细介绍了如何在Android设备上使用GDB进行core dump调试,包括将必要的符号文件放入对应目录、设置环境、加载core dump文件及打印backtrace等关键步骤,并提供了实际操作的日志示例。

步骤

首先,编译生成的out/target/product/$project/symbols目录的如下文件放到您新建的symbols 文件夹下,目录结构保持一致:(symbols 例子)
symbols/system/lib/libbinder.so
symbols/system/lib/libandroid_runtime.so
symbols/system/lib/libutils.so
symbols/system/lib/libc.so
symbols/system/bin/app_process

然后把symbols 目录放到和coredump 存放一致的目录。

下面进行gdb 调试

1. 进入gdb 环境
如通过命令行进入 C:\Documents and Settings\mtk28119>arm-linux-androideabi-gdb

2. 转到coredump 存放的目录:
如 (gdb) cd D:\dd\coredump

3. 执行file 命令
如 (gdb) file symbols/system/bin/app_process
Reading symbols from D:\dd\coredump/symbols/system/bin/app_process...done.
4.执行set solib-serach-path
如 (gdb) set solib-search-path symbols/system/lib
5.执行core
如(gdb) core PROCESS_COREDUMP
6.执行 bt
如 (gdb) bt ,这样就可以打印出backtrace 出来了。

 

 

实测log

lumy1@linuxws15:~$ export PATH=$PATH:/home/lumy1/work/snoopy_dev2/sys/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin
lumy1@linuxws15:~$ arm-linux-androideabi-gdb count
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/lumy1/count...done.

WARNING: no debugging symbols found in /home/lumy1/count.
Either the binary was compiled without debugging information
or the debugging information was removed (e.g., with strip or strip -g).
Debugger capabilities will be very limited.
For further information: http://wiki/Main/GdbFaq#No_debugging_symbols_found

(gdb) set solib-search-path /home/lumy1/work/snoopy_dev2/sys/out/target/product/snoopy/symbols/system/lib
(gdb) info sharedlibrary
No shared libraries loaded at this time.
(gdb) core-file core-count.9362.0
warning: exec file is newer than core file.
[New LWP 9362]
warning: while parsing target library list: no element found
Core was generated by `./count'.
Program terminated with signal 11, Segmentation fault.
#0 0x40128020 in ?? ()
(gdb) where
#0 0x40128020 in ?? ()
#1 0x40162684 in cri_sig_handler () from libcr.so
#2 0x40096188 in ?? () from /home/lumy1/linker
#3 0x40096188 in ?? () from /home/lumy1/linker
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值