bt命令:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x920f6b70 (LWP 5472)] 0xb5045559 in ?? () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 (gdb) bt #0 0xb5045559 in ?? () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #1 0xb50484ac in ?? () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #2 0xb50489dd in realloc () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #3 0xb7f310ad in xrRealloc (ptr=0xa8d8f90, size=26896) at ../../base/mem/mem_cmn.c:53 #4 0xb4b84fd2 in initRGAnaVal (pMsg=0xa8d8d80, sum=1681) at ../../../frcore/rarecorder/src/reccomtrade.c:1757 #5 0xb4b87cd2 in getCTriggerMsg () at ../../../frcore/rarecorder/src/reccomtrade.c:2609 #6 0xb4b88fb1 in getTrigger () at ../../../frcore/rarecorder/src/reccomtrade.c:3033 #7 0xb4b89036 in processData () at ../../../frcore/rarecorder/src/reccomtrade.c:3069 #8 0xb4b883d7 in processComtrade () at ../../../frcore/rarecorder/src/reccomtrade.c:2792 #9 0xb4ba95cf in recProcessSV (pSV=0x8a845798) at ../../../frcore/rarecorder/src/recprocessor.c:468 #10 0xb4b78487 in recSvTask (arg=0x0) at ../../../frcore/rarecorder/src/frprot.c:162 #11 0xb7fc1c39 in start_thread () from /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 #12 0xb50a8d2e in clone () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
停在libc.so中了。list命令由于找不到库代码,直接停在了main入口。直接p命令打印函数栈中的参数,找不到。
那么,使用f命令,沿着调用栈找吧。
(gdb) f 4 #4 0xb4b84fd2 in initRGAnaVal (pMsg=0xa8d8d80, sum=1681) at ../../../frcore/rarecorder/src/reccomtrade.c:1757 1757 if ((pVal = xrRealloc(pMsg->pVal, sum*xrSZOF(GANA_VAL))) == NULL) (gdb)
(gdb) p pVal $1 = (GANA_VAL *) 0x0
参考:
http://blog.csdn.net/linfeng999/article/details/38413945