gdb 的 l 命令

来源:百度知道 编辑:UC知道 时间:2024/06/25 05:09:16
使用 gdb 调试的时候 输入 l 之后出现下列信息

(gdb) l
1 ../sysdeps/i386/elf/start.S: No such file or directory.
in ../sysdeps/i386/elf/start.S

并没有列出源代码的效果??为什么啊
我执行的步骤是这样的,先在桌面的一个untitled folder里建立一个test.c的文件
源码就是“hello world”,然后用gcc在此目录下生成test执行文件,后来还改了名称为tst
最后用gdb ./tst 使用 l 没有效果,
不知道start.S是干什么的

gcc test.c -o test

gcc test.c -o test -g

那个-g是告诉gcc把调试信息加进来的。 具体你可以man gcc看看。
-g:
Produce debugging information in the operating system's native format. GDB can work with this debugging information.

你的文件系统../sysdeps/i386/elf/start.S位置没有start.S这份源码。

路径“../sysdeps/i386/elf/start.S”是编译目标文件时确定的。请确认编译后是否移动了源文件或换了调试环境。

----------------------------

你的编译参数都什么?贴来看看。

----------------------------

晕,用这个
gcc test.c -o test -g

那个-g是告诉gcc把调试信息加进来的。 具体你可以man gcc看看。
-g:
Produce debugging information in the operating system's native format. GDB can work with this debugging information.