嵌入式Linux gdb core dump快速定位程序crash问题

 

指定生成 core dump 文件:

echo "/tmp/core-%e-%p-%t" > /proc/sys/kernel/core_pattern
ulimit -c unlimited

复现问题之后,取出 /tmp 目录下面的 core dump文件

运行:

 

/opt/rk3308/bin/arm-rockchip-linux-gnueabihf-gdb uni_demo core-uni_demo-3072-1985

出现以下问题:
/opt/rk3308/bin/arm-rockchip-linux-gnueabihf-gdb: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory

发现所依赖的库在交叉编译工具包里面,指定所依赖的交叉编译工具包路径;

export LD_LIBRARY_PATH=/opt/rk3308/lib

可以发现:

 

GNU gdb (GDB) 7.11.1
Copyright (C) 2016 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-pc-linux-gnu --target=arm-rockchip-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from uni_demo...done.
[New LWP 3078]
[New LWP 3082]
[New LWP 3081]
[New LWP 3086]
[New LWP 3073]
[New LWP 3108]
[New LWP 3087]
[New LWP 3088]
[New LWP 3085]
[New LWP 3107]
[New LWP 3102]
[New LWP 3094]
[New LWP 3074]
[New LWP 3101]
[New LWP 3093]
[New LWP 3100]
[New LWP 3089]
[New LWP 3084]
[New LWP 3072]
[New LWP 3083]
[New LWP 3092]
[New LWP 3090]
[New LWP 3077]
[New LWP 3106]
[New LWP 3091]

warning: Could not load shared library symbols for 37 libraries, e.g. linux-vdso.so.1.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `./uni_demo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xb595a940 in ?? ()
[Current thread is 1 (LWP 3078)]
(gdb) bt
#0 0xb595a940 in ?? ()
#1 0x7f5e27c0 in _parse_music_content (content=0xa9d00b70) at music_handler.c:380
#2 _action_start (event_info=<optimized out>) at music_handler.c:822
#3 0x7f5e16a0 in _start_handler (event_info=0xb3c0fdec) at music_handler.c:1191
#4 0x7f5c682e in _session_process (handler=0x813ed328, event_info=<optimized out>) at session_manage.c:263
#5 0x7f5c842a in _handle_event (args=0x813ecc88) at uni_event_list.c:42
#6 0xb6ba857c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) q

 

posted @ 2019-04-23 10:59  慢伴拍的二叉树  阅读(2341)  评论(0编辑  收藏  举报