Author Topic: NB: how to debug under linux  (Read 6190 times)


  • Guest
NB: how to debug under linux
« on: February 11, 2005, 09:59:15 AM »

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 ?


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2596
  • Country: us
Re: NB: how to debug under linux
« Reply #1 on: February 11, 2005, 05:50:08 PM »
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...

    ; my code

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



  • Guest
Re: NB: how to debug under linux
« Reply #2 on: February 15, 2005, 12:40:33 PM »
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