tags:

views:

99

answers:

4
+1  Q: 

DEBUG For Linux

I'm now extending more my x86 Assembly knowledge and one of the best tools for learning is DEBUG. When I was learning Assembly(past 4 years) I was on Windows, but now I'm on Linux Ubuntu and the DEBUG tool is only for Windows. Then I want to know is there is any port or equivalent for Linux.

Remember that I don't want to debug my code, but do things like the command -r, -t, -e...

A: 

gdb - the GNU project debugger is the Linux standard debugger. It is far more powerful than DEBUG (if by that you mean the old DOS tool) and you should really learn at least the basics of how to use it if you are programming on Linux.

anon
+3  A: 

gdb is pretty much the debugger on the Linux platform. You don't specify what features you require, but it probably has them :)

Thomas
Sorry for this, now I've specified the feature that I want.
Nathan Campos
+2  A: 

I used DEBUG mostly to assemble rather than "debugging"... if that's your goal,

  • NASM is a good assembler with more similar syntax

  • Use gdb to then run the code, allow disassembly, and examine memory

Joe Koberg
+2  A: 

-r = info registers
-t = stepi
-e = no direct equivalent; taviso wrote a macro providing similar functionality

debug with no args starts up with some blank 64k of memory that you can play around with; GDB doesn't. That really only made sense on DOS anyhow; you'll have to start with some binary.

Maybe assemble some blank slate like so?

$ echo .globl main >a.s
$ echo main: >>a.s
$ for i in {1..65536}; do echo 'int $3'; done >>a.s
$ cc a.s
$ gdb a.out
(gdb) run
ephemient
I heard that the GAS backend that assembles this code is designed to accept the (perfect) output of GCC - its error reporting thus not being that user friendly. I can't find the reference to this though.
Joe Koberg
It doesn't matter: we're assembling something so stupid and dumb that it can't possibly fail anyways. :-D This creates an object where `main` is just a 64kB sequence of breakpoints (`nop` and `.byte 0` didn't work well in my testing).
ephemient