Author Topic: I need a debugger for NASM programs  (Read 12780 times)

Offline kanito73

  • Jr. Member
  • *
  • Posts: 10
I need a debugger for NASM programs
« on: February 20, 2019, 12:35:39 AM »
Hello everybody

Finally I'm writing some assembly programs on Linux, but need a good debugger that supports assembly. Kdbg and DDD run the programs but Kdbg does not trace the code on the source window (just can see how change the registers and the IP register, I have to imagine or trace mentally the code), and DDD does not even show the code and the same thing that only advances IP and show register changes but the code windows is completely blank. They only work fine for C/C++ programs.

The only debugger that is able to load and trace assembly programs is GDB. It traces fine the execution but does not show the system stack, it only shows a function stack to trace the functions execution path and need to see the system stack since I'm working with it (PUSH/POP/ENTER/LEAVE to see and test how parameters are passed to functions, how to create and use stack frames, etc.)

Anybody knows about GOOD a Linux debugger supporting the system stack or how to show the system stack instead of the function execution stack? For my purposes, I do not require the functions-trace stack... I'm creating low level standalone functions...

Thanks for your help

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: I need a debugger for NASM programs
« Reply #1 on: February 20, 2019, 01:40:23 AM »
You almost certainly want GDB. It requires some learning! Unfortunately I used another debugger and never learned GDB. Assemble with "-F dwarf". Do not give ld the "-s" switch! Start your code with a "nop". A good  "gdbinit" file will help make GDB friendlier to asm. I do not currently have one.

This might(?) help:

https://www.cs.umb.edu/~cheungr/cs341/Using_gdb_for_Assembly.pdf

Good Luck!

Best,
Frank



Offline kanito73

  • Jr. Member
  • *
  • Posts: 10
Re: I need a debugger for NASM programs
« Reply #2 on: February 20, 2019, 03:26:08 AM »
You almost certainly want GDB. It requires some learning! Unfortunately I used another debugger and never learned GDB. Assemble with "-F dwarf". Do not give ld the "-s" switch! Start your code with a "nop". A good  "gdbinit" file will help make GDB friendlier to asm. I do not currently have one.

This might(?) help:

https://www.cs.umb.edu/~cheungr/cs341/Using_gdb_for_Assembly.pdf

Good Luck!

Best,
Frank

Thanks for your response!

The problem is already solved at this moment, just used -Fdwarf (instead of -Fstabs) and the assembly appeared and worked on Kdbg, for the stack I opened a "memory window" at SP +/- some qwords backward/forward and was able to show the stack and debug to see how it works. By the way, I'm still interested on using and learning GDB, I will study the PDF and the documentation to try to do the same in plain GDB.

Again, thanks a lot!