|
测试程序如下:
// name is : debugme.c
#include<stdlib.h>
#include<stdio.h>
#define BIGNUM 5000
void index_to_the_moon(int ary[]);
int main(void)
{
int intary[100];
index_to_the_moon(intary);
exit(EXIT_SUCCESS);
}
void index_to_the_moon(int ary[])
{
int i;
for(i=0;i<BIGNUM;++i)
ary=i;
}
使用gcc debugme.c -o debugme
ulimit -c unlimited
gdb debugme core
在GDB中执行run命令
显示如下:
(gdb) run
Starting program: /home/smile/src/debugme
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Program received signal SIGSEGV, Segmentation fault.
0x080483d9 in index_to_the_moon ()
如后又用list命令
显示如下:
(gdb) list
1 /var/tmp/portage/glibc-2.3.4.20040808-r1/work/build/csu/crti.S: No such file or directory.
in /var/tmp/portage/glibc-2.3.4.20040808-r1/work/build/csu/crti.S
然后用pirnt i ,显示如下:
(gdb) print i
No symbol "i" in current context.
这些都不对阿,是不是我GDB装的有问题阿?????
我的系统是GENTOO 2004.3 使用了nptl。
请教一下这是什么原因?
:help |
|