public inbox for
 help / color / mirror / Atom feed
* adding custom stabs symbols
@ 2022-08-03 17:42 Tavis Ormandy
  0 siblings, 0 replies; only message in thread
From: Tavis Ormandy @ 2022-08-03 17:42 UTC (permalink / raw)
  To: gdb

Hello, I tried asking this on the binutils list but thought I would try
here too.

I have a stripped binary I don't have the source for that I would
like to debug in gdb. I know where some functions and globals are, so I
thought a clever solution might be writing some .stabs statements in
gas, like this:

.equ N_FUN, 0x24
.equ N_PSYM, 0xa0
.stabs "example:f-11", N_FUN, 0, 0, 0x8005bba
.stabs "foo:p*-8", N_PSYM, 0, 0, 8
.stabs "bar:p-10", N_PSYM, 0, 0, 12

I think this describes a function like this at address 0x8005bba:

void example(unsigned int *foo, unsigned long bar);

That sort of works, if I assemble it (as -gstabs), then add-symbol-file
a.out, gdb knows about the address and type. The problem is it won't
resolve it in backtraces:

(gdb) add-symbol-file a.out
(gdb) info address example
Symbol "example" is a function at address 0x8005bba.
(gdb) pt example
type = void (unsigned int *, unsigned long)
(gdb) bt
#1  0x0000000008005bba in ?? ()     <-- unresolved

What am I doing wrong?

This is still better than nothing, at least I can put breakpoints on the
names and print globals, but is there a better way to accomplish what
I'm trying to do?


 _o)            $ lynx
 /\\  _o)  _o)  $ finger
_\_V _( ) _( )  @taviso

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-03 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 17:42 adding custom stabs symbols Tavis Ormandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).