public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Nat! <nat@mulle-kybernetik.com>
Cc: gdb@sourceware.org
Subject: Re: How to add a second "this" (sort of, or maybe do something totally different)
Date: Tue, 08 Mar 2022 15:00:10 -0700	[thread overview]
Message-ID: <87a6e02jh1.fsf@tromey.com> (raw)
In-Reply-To: <d403f219-8a21-5031-a4fe-f44f8249f63a@mulle-kybernetik.com> (Nat!'s message of "Fri, 25 Feb 2022 01:28:35 +0100")

>>>>> ">" == Nat!  <nat@mulle-kybernetik.com> writes:

>> The actual method parameters are accessed indirectly through
>> "_param".  So the functions may have looked like this in the
>> Objective-C source code:

>> int     foo1:(int) a :(void *) b;
>> void foo2:(double) a :(void *) b;
>> char  *foo3:(int) a :(int) b :(int) c;

If this is an Objective-C compiler and/or ABI thing, then gdb could be
taught about it directly, I suppose.  I'm not sure how well the existing
Objective-C code in gdb works, so it may require other changes as well.

>> I am looking for the least effort route to support something like this
>> for "_param" as well, in gdb. What would be really great, would be to 
>> also show the struct fields in the stack trace instead of "_param".

gdb has limited support for this kind of thing.  I don't think there's a
good way, currently, do augment 'print' like this.  That would requiring
hooking into expression parsing / evaluation somehow.

For stack traces in particular, a "frame filter" can synthesize
'variables' like this.

>> Getting the compiler to output some fake dwarf
>> "DW_TAG_formal_parameter" for each struct field with a computed dwarf
>> expression, is maybe the proper way it could be done. But that's not
>> least effort for me by a long shot.

Parameters are tricky because gdb can also do inferior calls, so it has
to understand some of these details in a way that DWARF doesn't express.

Tom

      reply	other threads:[~2022-03-08 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  0:28 Nat!
2022-03-08 22:00 ` Tom Tromey [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=87a6e02jh1.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb@sourceware.org \
    --cc=nat@mulle-kybernetik.com \
    /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).