[vox-tech] advanced gdb question

Micah Cowan vox-tech@lists.lugod.org
Fri, 14 Jun 2002 18:58:38 -0700


Peter Jay Salzman writes:
 > hey there,
 > 
 > every tutorial on gdb says "compile with -g" within the first few lines.
 > but what if you don't?  or rather, what if you can't compile with -g?
 > 
 > but how do you inspect arguments, local variables, etc. in a given frame
 > if you don't know the address of these variables because the symbol
 > table is unavailable?

Well, without compiling with -g, you obviously don't have the
convenience of debugging symbols and whatnot - but you should still be
able to examine the program as raw assembly (hey, it's better than raw
machine code).

I just tried it on /bin/echo (stripped).

You can set the initial breakpoint with: b main

after beginning the run, you'll be in main, and you can use: disas
to disassemble the current function. You'll get the whole
function. You can set breakpoints at specific addresses, and move on
that way.

It's a mess, but it's something.

I'm no gdb expert, so I'm sure someone can offer better advice than
this...?

Micah