|
用了一个很简单的测试程序
/* greeting.c */
main()
{
char my_string[]="hello there";
my_print(my_string);
my_print2(my_string);
}
void my_print(char *string)
{
printf("The string is %s \n",string);
}
void my_print2(char *string)
{
char *string2;
int size,i;
size=strlen(string);
string2=(char*)malloc(size+1);
for(i=0;i<size;i++)
string2[size-i]=string;
string2[size+1]='\0';
printf("The String printed backward is %s \n",string2);
}
可是调试的时候出来这样的错误:
[root@BillingServer 3]# gdb greeting
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 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 "i386-redhat-linux-gnu"...
(gdb) file greeting
Reading symbols from greeting...done.
上面还是对的,可是下面可就出错了
(gdb) list
1 ../sysdeps/i386/elf/start.S: 没有那个文件或目录.
in ../sysdeps/i386/elf/start.S
list命令不是列举出程序的意思吗?!搞不懂为什么了,痛苦?!
注明一下:我是按照这个帖子进行测试的
http://www.lslnet.com/linux/docs/linux-2725.htm |
|