public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tavis Ormandy <taviso@gmail.com>
To: binutils@sourceware.org
Subject: Re: making stabs visible to gdb
Date: Sat, 20 Aug 2022 04:49:14 -0000 (UTC)	[thread overview]
Message-ID: <tdpp4a$14qv$1@ciao.gmane.io> (raw)
In-Reply-To: <tdpe90$u1n$1@ciao.gmane.io>

On 2022-08-20, Tavis Ormandy via Binutils wrote:
> On 2022-08-05, Tom Tromey wrote:
>>>> Also, is there a better way to accomplish what I'm trying to do?
>>
>> In the gdb test suite, we have some Tcl code that makes it relatively
>> simple to create synthetic DWARF.  So, I'd consider extracting that and
>> using it to describe your program.
>>
>
> Hmm thanks, it kinda works - but it generates tons of warnings like
> this:
>
> warning: (Internal error: pc 0x8129250 in read in psymtab, but not in
> symtab.)

Nevermind, I figured it out - just making sure a matching section exists
that overlaps that region hides the warning.

This actually works really well, I made some gas macros to make the
syntax nice:

.include "symbols.s"

# bool rddec(char **numstr, uint16_t *num) @ 0x81dac90
function rddec, %bool, 0x81dac90
    param numstr, ** %char
    param num, * %uint16_t

It works perfectly:

(gdb) add-symbol-file symbols.dbg
(gdb) pt rddec
type = boolean (char **, unsigned short *)
(gdb) x/i rddec
0x81dac90 <rddec>:   push   ebp
(gdb) b rddec
Breakpoint 1 at 0x81dac96
(gdb) r

Even parameters work nicely:

Breakpoint 1, 0x081dac96 in rddec (numstr=0xffffc044, num=0x8350dbe)
(gdb) pt numstr
type = char **
(gdb) p *numstr
$1 = 0xffffc048 "06"

I'm really pleased with how this turned out, thanks for the hints!

Tavis.

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


      reply	other threads:[~2022-08-20  4:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  5:11 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='tdpp4a$14qv$1@ciao.gmane.io' \
    --to=taviso@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).