gdb调试问题,关于list命令的

hahabas 2005-06-22 02:21:07
小弟在调试一个C语言的可执行文件。出现以下问题。我在使用list命令时不显示出程序的源码,这是怎么回事啊,出错的信息如下,请高手指点。

# gdb test
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) run
Starting program: /root/test
The string is hello there
The string printed backward is

Program exited with code 040.
(gdb) list
1 ../sysdeps/i386/elf/start.S: 没有那个文件或目录.
in ../sysdeps/i386/elf/start.S
(gdb) list
1 in ../sysdeps/i386/elf/start.S
(gdb) list
1 in ../sysdeps/i386/elf/start.S
(gdb) list
1 in ../sysdeps/i386/elf/start.S
(gdb)
...全文
103 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hundlom 2005-06-22
  • 打赏
  • 举报
回复
gcc -g参数用来支持调试
检查
zhousqy 2005-06-22
  • 打赏
  • 举报
回复
可能如楼上所说
leeyiqun 2005-06-22
  • 打赏
  • 举报
回复
你在用gcc编译的时候没有加上选项-g,
比如你想编译一个源程序test.c生成一个目标程序test,得这样
gcc test.c -g -o test,
用gdb调试test的时候用list就可以看到源程序了。

23,114

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧