InvalidBrainException
InvalidBrainException

Reputation: 2362

Debugging assembly code created with yasm

I need some help finding and using a good debugger for asm code assembled with yasm on 64-bit Linux. The gdb debugger keeps complaining that no symbol tables are loaded. Someone on stackoverflow suggested assembling with the -dstabs switch, but that makes no difference for me. Neither does ddd make a difference.

gdb wouldn't be so bad if I could find a way to get rid of the "no symbol tables loaded" problem. I also need to be able to view the contents of registers and other declarations.

I assemble my asm files using yasm -f elf -m amd64 file.asm and I link with ld file.o -o file. Creating a .lst file with yasm using the -l switch doesn't seem to work either.

All the advice I've found regarding this matter seem to be related to using gcc as a linker and not ld. I need to be able to link with ld.

Upvotes: 1

Views: 2767

Answers (2)

Arod529
Arod529

Reputation: 13

I'm currently taking systems programming, and we use ddd for debugging, using the -g dwarf2 flag. It has worked well so far.

Upvotes: 0

mtvec
mtvec

Reputation: 18326

You should use the -g option to yasm. I'd suggest using the dwarf2 format as that seems to be the standard nowadays.

yasm -f elf -m amd64 -g dwarf2 file.asm

Upvotes: 5

Related Questions