views:

48

answers:

3

Hello everyone,

I'm writing a compiler that converts source code (written in a small imperative programming language) to Intel AT&T 32-bit assembler.

I tend to spend a lot of time debugging, because of nasty offset-mistakes etc. in the generated code, and I would like to know if anyone knows of a tool to "walk through" the generated assembler code step-by-step, visualizing what's on the stack etc.

I use Ubuntu Linux as my development platform, and I'm comfortable with the terminal -- a GUI-program would be nice though. Does it exist? Or is there a good reason it doesn't (maybe the problem isn't so straightforward..?)

If you have good ideas for approaching debugging tasks in assembly code, I'll be glad to hear from you!

A: 

Is the end result of the compile process something that you can actually execute, and therefore examine in a debugger? If so the Data Display Debugger (ddd) might be useful.

torak
.. It gives a "[currentdir]/sysdeps/i386/elf/start.S: No such file or directory" error -- maybe I have to implement something similar to the "-g" option in gcc in my compiler.. :-/..
Søren Haagerup
A couple of quick internet searches suggests something along those lines. My guess (pure speculation) is that gdb, which underlies ddd, is attempting to find somewhere suitable to insert an initial break point. If you're compiling the resultant assembler with "as" then it understnds -g as well.
torak
+1  A: 

I like EDB (Evan's Debugger) on Linux. It has a nice, easy-to-use, QT4-based GUI. Its developer's goal is to make it similar to OllyDbg. And it's being actively maintained:

EDB on FreshMeat

I'm pretty sure it's installable through Synaptic on Ubuntu as well. Enjoy!

Eric
I found that EDB is NOT actually available through Synaptic. You'll have to compile it from the source package available at FreshMeat.
Eric
A: 

My experience with debuggers such as Olly and EDB is quite sparse, so I wasn't able to solve my problem with those. I ended up

  • scattering calls around to a Debug function in the source code, nailing down bad register values
  • letting the compiler output HTML-formatted code with useful metadata for different iterations in the liveness analysis etc.
Søren Haagerup