日期:2014-05-16 浏览次数:20684 次
首先,编译生成的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 出来了。
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?)