public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* making stabs visible to gdb
@ 2022-08-03  5:11 Tavis Ormandy
  2022-08-05  9:21 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Tavis Ormandy @ 2022-08-03  5:11 UTC (permalink / raw)
  To: binutils

Hello, I have a stripped binary I don't have the source for that I would
like to debug in gdb. I thought writing some .stabs statements in gas
would be a nice easy way to record the symbols I know about, 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

https://sourceware.org/binutils/docs/as/Stab.html

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

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

If I assemble that (as -gstabs), then add-symbol-file a.out, gdb knows
about it but 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?

Also, is there a better way to accomplish what I'm trying to do?

Tavis.

-- 
 _o)            $ lynx lock.cmpxchg8b.com
 /\\  _o)  _o)  $ finger taviso@sdf.org
_\_V _( ) _( )  @taviso


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-20  4:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  5:11 making stabs visible to gdb Tavis Ormandy
2022-08-05  9:21 ` Nick Clifton
2022-08-05 14:50   ` Tom Tromey
2022-08-20  1:44     ` Tavis Ormandy
2022-08-20  4:49       ` 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).