Re: assembly editing in GDB

Carlos O'Donell
2002-08-06T13:28:22Z

On Tue, Aug 06, 2002 at 11:52:46AM +0530, Vinayak P Risbud wrote:
> Can I run and debug, an assembly program in GDB ?
> If yes, how can I edit and write the assembly program
> in GDB ?

GDB is a debugger not an editor :}

Assembly programs can definately be debug'd in gdb.
Just start it up as you would with any other program,
and start putting break points at addresses instead of
source lines.

# gdb hello
> break main
> r
...
> disassemble

And if you want to _edit_ it while running you need to
use 'set write on' (before loading) and then 'file hello'.

Check out all the variations of break, since you will have
to feed it addresses for code that doesn't have debug info.

I really really really recommend reading all the material
at: http://sources.redhat.com/gdb/documentation/

c.