NASM Forum > Using NASM

NB: how to debug under linux

(1/1)

nobody:
Hello

I am wondering how one can debug nasm code under linux. I wrote (or better copied from the net) a small "hello world" programm which one can compile using "nasm -f elf -o helloworld.o helloworld.asm" and "ld -o helloworld helloworld.o". The programs works fine but if I try to run it with ddd I do not see any code. I can run it but not set any breakpoints and all the stuff.

Any idea ?

Pedro

Frank Kotler:
Add the "-g" switch to the command line for Nasm, and debug info should appear. I don't know if it's acually required, but gdb seems to like a one-byte instruction at the beginning of your code - I guess it gets replaced by a breakpoint...

_start:
    nop
    ; my code

I'm not at all familiar with ddd. If you discover any "helpful hints" for it - post 'em!

Best,
Frank

nobody:
Thank's for the hint. "-g" works fine. Also the "nop" at the beginning is useful. In the other case one cannot set breakpoints to stop the program at the very beginning.

I am not familiar with ddd too. Just want to watch what's going on within the registers.

Thank's for help

Pedro

Navigation

[0] Message Index

Go to full version