Gareth Williams
Gareth Williams

Reputation: 643

How do I make gdb frontends show the current instruction arrow in assembly source code window?

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.

Upvotes: 1

Views: 963

Answers (1)

Jester
Jester

Reputation: 58802

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

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

Upvotes: 4

Related Questions