使用 GDB 时,如何查看 GDB 停止在哪条 C(而非汇编)指令上?
看,问题是我应该使用可执行驱动程序 (vdriver) 来测试我编写的 C 源文件 (myfile.c),其中包含驱动程序将使用的方法集合。我使用 gcc 将它们编译在一起(以及它们依赖的任何文件),然后运行“gdb vdriver”
显然,我在 myfile.c 中的某处遇到了段错误。 “dissasemble”生成的汇编代码甚至可以在汇编中显示整个方法,并指向刚刚出现段错误的指令。
错误的这一行会更有效。
但是,运行命令“list *$eip”会导致:
No source file for address 0x804a3d3
然而,由于汇编代码的复杂性(和长度),我认为查看 C 中发生段 知道如何进行这项工作吗?
See, the problem is that I'm supposed to use an executable driver program (vdriver) to test the C source file I wrote (myfile.c) containing a collection of methods the driver program will use. I used gcc to compile them together (and also any files they depend on) and then ran "gdb vdriver"
Apparently, I am getting a segfault somewhere in myfile.c. The "dissasemble"-produced assembly code can even display the whole method in assembly and point to which instruction just segfaulted.
However, due to the complexity (and length) of the assembly code, I think it would be much more effective to view this line where the segfault occurred in C.
However, running the command "list *$eip" results in:
No source file for address 0x804a3d3
Does anyone know how to make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用调试信息进行编译。
更新:您似乎在调用 GCC 时也遇到了问题。我建议编写一个 Makefile,并快速浏览一下 GCC 手册以了解
-c
和-o
的含义。Compile with debugging info.
Update: It looks like you're having trouble invoking GCC as well. I suggest writing a Makefile, and taking a quick look through the GCC manual for what
-c
and-o
mean.