配置core文件生成
# ulimit -c unlimited # echo "/var/core-%e-%p-%t" > /proc/sys/kernel/core_pattern # cat /proc/sys/kernel/core_pattern /var/core-%e-%p-%t
生成的core
# ls /var/core-dump-1063-991181935
core分析
# arm-none-linux-gnueabi-gdb a.out GNU gdb (Sourcery G++ Lite 2011.03-41) 7.2.50.20100908-cvs Copyright (C) 2010 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=i686-pc-linux-gnu --target=arm-none-linux-gnueabi". For bug reporting instructions, please see: <https://support.codesourcery.com/GNUToolchain/>... Reading symbols from /mnt/hgfs/build/a.out...done. (gdb) (gdb) set solib-search-path /home/rootfs/lib (gdb) info sharedlibrary From To Syms Read Shared Object Library 0x401d501c 0x401e6f64 Yes (*) /home/rootfs/lib/libgcc_s.so.1 0x40206c00 0x402ffb5c Yes (*) /home/rootfs/lib/libc.so.6 0x4007e7d0 0x40098f58 Yes (*) /home/rootfs/lib/ld-linux.so.3 (*): Shared library is missing debugging information. (gdb) core-file /home/core-dump-1063-991181935 warning: exec file is newer than core file. [New LWP 1063] Reading symbols from /home/rootfs/lib/libgcc_s.so.1...(no debugging symbols found)...done. Loaded symbols for /home/rootfs/lib/libgcc_s.so.1 Reading symbols from /home/rootfs/lib/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /home/rootfs/lib/libc.so.6 Reading symbols from /home/rootfs/lib/ld-linux.so.3...(no debugging symbols found)...done. Loaded symbols for /home/rootfs/lib/ld-linux.so.3 Core was generated by `./dump'. Program terminated with signal 11, Segmentation fault. #0 0x4026e854 in memcpy () from /home/rootfs/lib/libc.so.6 (gdb)