文章作者 100test 发表时间 2007:09:06 12:08:00
来源 100Test.Com百考试题网
1 dummy_function (void) 2 { 3 unsigned char *ptr = 0x00. 4 *ptr = 0x00. 5 } 6 7 int main (void) 8 { 9 dummy_function (). 10 11 return 0. 12 } |
xiaosuo@gentux test $ ./a.out 段错误 |
xiaosuo@gentux test $ gcc -g -rdynamic d.c xiaosuo@gentux test $ gdb ./a.out GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) r Starting program: /home/xiaosuo/test/a.out Program received signal SIGSEGV, Segmentation fault. 0x08048524 in dummy_function () at d.c:4 4 *ptr = 0x00. (gdb) |
The default action of certain signals is to cause a process to terminate and produce a core dump file, a disk file containing an image of the process s memory at the time of termination. A list of the signals which cause a process to dump core can be found in signal(7). |
xiaosuo@gentux test $ ulimit -c 0 xiaosuo@gentux test $ ulimit -c 1000 xiaosuo@gentux test $ ulimit -c 1000 xiaosuo@gentux test $ ./a.out 段错误 (core dumped) xiaosuo@gentux test $ ls a.out core d.c f.c g.c pango.c test_iconv.c test_regex.c |
xiaosuo@gentux test $ gdb ./a.out core GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". warning: Can t read pathname for load map: 输入/输出错误. Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Core was generated by `./a.out . Program terminated with signal 11, Segmentation fault. #0 0x08048524 in dummy_function () at d.c:4 4 *ptr = 0x00. |
相关文章
Ubuntu系统访问Windows共享文件夹的技巧
Linux与Windows系统下Cronolog安装配置
LAMP(Linux Apache Mysql PHP)优化技巧
如何来量身定制安全的Linux系统服务平台
Linux系统内存错误产生的原因及调试方法
通过rpm包安装、配置及卸载mysql
在Linux操作系统上配置D 服务器的日志
在你的UbuntuLinux桌面上嵌入终端窗口
Linux环境进程间通信:管道及有名管道
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛