如何让gdb前端在汇编源代码窗口中显示当前指令箭头? [英] How do I make gdb frontends show the current instruction arrow in assembly source code window?

查看:318
本文介绍了如何让gdb前端在汇编源代码窗口中显示当前指令箭头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上执行一些x86汇编编码(Arch 64),使用nasm进行汇编和ld链接,从而创建一个32位可执行文件:

  wordcount:wordcount.o 
ld -o wordcount wordcount.o -melf_i386

wordcount.o:wordcount.asm
nasm -f elf -g -F stabs wordcount.asm -l wordcount.lst

当我打开gdb下的可执行文件(版本7.7)源码符号加载好了,我可以通过各种前端的源代码窗口设置断点(我试过GUD在Emacs(24.3.1),ddd(3.3.12)和kdbg(2.5.4 )),但是在单步执行代码时,当前行不会显示箭头或三角符号,就像在逐步执行C源代码时所发生的那样。



我已经看了解类似问题的答案,我知道我可以通过反汇编窗口找到我当前的指令,或者通过获取主gdb窗口来拆卸下一行,但我真的很想获得e在源窗口中工作的当前线箭头指示器,以便在单步执行代码时查看源代码。有没有人得到这个工作?或者有什么理由不对汇编语言程序起作用?



注意:我也尝试过创建一个64位可执行文件,并且有同样的问题。 / p>

解决方案

您应该使用矮人格式而不是 stabs

  nasm -f elf -g -F dwarf wordcount.asm -l wordcount.lst 


I'm doing some x86 assembler coding on Linux (Arch 64), using nasm to assemble and ld to link, to create a 32-bit executable thus:

wordcount: wordcount.o
    ld -o wordcount wordcount.o -melf_i386

wordcount.o: wordcount.asm
    nasm -f elf -g -F stabs wordcount.asm -l wordcount.lst

When I open the executable under gdb (version 7.7) the source symbols are loaded ok, and I can set breakpoints via the source window in the various frontends (I've tried GUD under Emacs (24.3.1), ddd (3.3.12) and kdbg (2.5.4)), but when stepping through the code, the current line is not indicated with an arrow or triangle symbol, as happens when stepping through C source code.

I've looked at the answers to similar questions, and I understand that I can find my current instruction via the disassembly window, or by getting the main gdb window to disassemble the next line, but I'd really like to get the current line arrow indicator working in the source window, so that I can look at my source when single-stepping through the code. Has anyone got this working? Or is there a reason why this should not work for assembly language programs?

NB: I've tried creating a 64-bit executable too and have the same problem.

解决方案

You should use the dwarf format instead of stabs, like so:

nasm -f elf -g -F dwarf wordcount.asm -l wordcount.lst

这篇关于如何让gdb前端在汇编源代码窗口中显示当前指令箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆