抓内存错误时,挂gdb运行程序,总是碰到Program received signal SIG32, Real-time event 32.的问题,程序总是被挂起,
然后就需要不停的c(continue),很麻烦
解决方法:在进入gdb之后,运行程序之前,输入handle SIG32 nostop命令,可以让程序接收到sig32信号时,不挂起
log:
Welcome to HiLinux, using uClibc-0.9.28
# cd /mnt/
#./gdb eis
GNU gdb 6.4
Copyright 2005 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 "--host=arm-uclibc-linux --target="...Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) handle SIG32 nostop
Signal Stop Print Pass to program Description
SIG32 No Yes Yes Real-time event 32
(gdb) r
Starting program: /mnt/eis
另外记录一下core dump的用法
首先,文件系统必须是可写的,因为需要创建core dump文件
在运行程序之前,输入ulimit -c unlimited命令,也可以加core dump文件的大小限制,比如ulimit -c 4096
具体过程如下:
cd /mnt
# ulimit -c unlimited
#./eis
>>>>>>> Built Application : at Dec 26 2008 at 21:50:15 <<<<<<<<
Segmentation fault (core dumped)
#ls
core.80 eis gdb
# ./gdb eis core.80
GNU gdb 6.4
Copyright 2005 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 "--host=arm-uclibc-linux --target="...Using host libthread_db library "/lib/libthread_db.so.1".
warning: exec file is newer than core file.
Core was generated by `./eis'.
Program terminated with signal 11, Segmentation fault.
#0 0x0020f498 in throwException (exceptionH=Cannot access memory at address 0xbebc8aac
) at frame.c:545
545 frame.c: No such file or directory.
in frame.c
(gdb) bt
#0 0x0020f498 in throwException (exceptionH=Cannot access memory at address 0xbebc8aac
) at frame.c:545
Cannot access memory at address 0xbebc8adc
(gdb)
这里只能打出一行堆栈,还不清楚为什么