GDB的调试问题大侠来下阿

q198816 2008-09-09 04:55:04
gdb下的一些功能有时候有有时候没有到底怎么回事呢?比如:
[Magic@localhost luanma]$ gdb w
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(no debugging symbols found)
(gdb) break main
Breakpoint 1 at 0x8048462
(gdb) run
Starting program: /home/luanma/w
(no debugging symbols found)/////////有时候有有时候没有的
(no debugging symbols found)
(no debugging symbols found)

Breakpoint 1, 0x08048462 in main ()
Missing separate debuginfos, use: debuginfo-install glibc.i686
(gdb) list
No symbol table is loaded. Use the "file" command.有时候可以用的有时候不能用就这样
(gdb) break w.c:5
No symbol table is loaded. Use the "file" command.
(gdb)

有时候确又是好的怎么办?
...全文
959 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangwj122 2010-01-12
  • 打赏
  • 举报
回复
谢谢哦,我也遇到了同样的问题,哈哈
jufeng2309 2008-09-09
  • 打赏
  • 举报
回复
还是一个初级问题,调试需要含有调试信息的可执行文件!
realdragon2 2008-09-09
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 x86 的回复:]
如楼上所说,编译时加上-g选项才会有调试信息,list命令才会看到源码。no debugging symbols found也是这个原因。
带-g选项编译的二进制也可以复制到其他机器进行调试,但是需要在同样的目录结构下有源代码,否则list命令也会找不到源码。
[/Quote]
x86 2008-09-09
  • 打赏
  • 举报
回复
如楼上所说,编译时加上-g选项才会有调试信息,list命令才会看到源码。no debugging symbols found也是这个原因。
带-g选项编译的二进制也可以复制到其他机器进行调试,但是需要在同样的目录结构下有源代码,否则list命令也会找不到源码。
快乐田伯光 2008-09-09
  • 打赏
  • 举报
回复
编译的时候要加-g选项

23,217

社区成员

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

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