(1) ulimit -c unlimited 把權限改爲 不限定 ,
(2) 測試程序:
#include <stdio.h>
int main(int argc, char **argv)
{
int *p = NULL;
printf("Hello World!\n");
*p =0x12;
printf("application out!");
return 0;
}
./Test
出現錯誤:
Hello World!
Segmentation fault (core dumped)
然後在當前目錄下生成core 的文件
將 /opt/root_fs/core ./
root@ubuntu:/home/s123/c_priace# /usr/local/arm-gdb/bin/arm-linux-gdb ./Test ./core
GNU gdb (GDB) 7.4
Copyright (C) 2012 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-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/s123/c_priace/Test...done.
[New LWP 465]
warning: Could not load shared library symbols for 3 libraries, e.g. /lib/libgcc_s.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 `./Test'.
Program terminated with signal 11, Segmentation fault.
#0 0x00008494 in main (argc=1, argv=0xbedebcc4) at Test.c:9
9 *p =0x12;
(gdb) l
4 {
5 int *p = NULL;
6 printf("Hello World!\n");
7
8
9 *p =0x12;
10
11 printf("application out!");
12 return 0;
13 }
(gdb)