From: Guinevere Larsen <guinevere@redhat.com>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Cc: Guinevere Larsen <blarsen@redhat.com>
Subject: Re: [PATCH v5 3/5] gdb: Migrate frame unwinders to use C++ classes
Date: Thu, 10 Oct 2024 11:10:39 -0300 [thread overview]
Message-ID: <c56bc796-7b4c-49c0-b395-e25732daa929@redhat.com> (raw)
In-Reply-To: <ce6062d9-f068-420f-bd8f-73e90da0b7fc@simark.ca>
On 10/4/24 2:21 AM, Simon Marchi wrote:
> Some more things I thought about...
>
>>> + /* Default frame sniffer. Will always return that the unwinder
>>> + is able to unwind the frame. */
>>> + virtual int sniffer (const frame_unwind *self,
> One nit: I think this method should be called just "sniff". When a
> method is named after a thing, my brain adds an implicit "get_" in front
> of it. So to me, a method named "sniffer" would return some sniffer
> object. Here, I think it would make more sense to use an action verb,
> because we want the unwinder to "sniff".
This makes sense, and is a pretty trivial change. Fixed.
>
> Oh and I guess another naming nit, I think frame_unwind should be named
> frame_unwinder. A "thing" that unwinds stuff would be called an
> "unwinder", not an "unwind". I don't know how you feel about changing
> that.
This is a reasonably big change, because several functions receive
frame_unwind as a parameter.
If we progress conversion from the legacy to the specific classes we're
going to reduce the number of function that get it as a parameter and it
will turn into a smaller, more manageable patch. I think makes sense for
future improvement.
>
> And something else I just remembered, I am not really a fan of the
> very abbreviated parameter names like this:
>
> frame_unwind_trampoline (enum frame_type t, const struct frame_data *d,
> frame_prev_arch_ftype *pa)
> : frame_unwind ("trampoline", t, FRAME_UNWIND_GDB, d), prev_arch_p (pa)
> { }
>
> When using an editor that provides tooltips when writing a function
> call, the abbreviated names in the tooltip are not very helpful. I
> would suggest using proper names.
This makes sense. I really dislike having a function named the same as a
type, but I will use "type", "data" and "prev_arch_func".
>>> +public:
>>> + frame_unwind_trampoline (enum frame_type t, const struct frame_data *d,
>>> + frame_prev_arch_ftype *pa)
>>> + : frame_unwind ("trampoline", t, FRAME_UNWIND_GDB, d), prev_arch_p (pa)
>>> + { }
>> This "frame_data" thing appears to be some kind of opaque / private data
>> that frame_unwind implementations can use? For those that you converted
>> to proper classes (trampoline and python), could that data be stored in
>> the frame_unwind_* object directly? It would remove some unnecessary
>> indirections and make things simpler, I think.
>>
>> Actually, I gave it a try, and trampoline and python are the only
>> implementations actually using the frame_data pointer. So if they stop
>> using it, we can just get rid of that. That requires touching all the
>> frame_unwind_legacy constructor call sites, but I was able to do that
>> relatively easily with a global regex find & replace in VScode. [last
>> minute edit: I just realized that I was building without
>> --enable-targets=all, so take this with a grain of salt]
> One more thought about all this: in an ideal world, the tramp_frame uses
> should probably become sub-classes of frame_unwind_trampoline. Only
> those sites that want to override the prev_arch method would need to do
> it (AFAIK, the only one is aarch64_linux_rt_sigframe). The `init` and
> `validate` callbacks in `tramp_frame` would become virtual methods of
> `frame_unwind_trampoline`, and the other data fields of `tramp_frame`
> would become fields of `frame_unwind_trampoline`. I started to
> prototype it on top of this patch, and it would be quite a lot of work.
> So let's keep that on the wishlist for now.
>
> Simon
>
--
Cheers,
Guinevere Larsen
She/Her/Hers
next prev parent reply other threads:[~2024-10-10 14:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 18:42 [PATCH v5 0/5] Modernize frame unwinders and add disable feature Guinevere Larsen
2024-10-01 18:42 ` [PATCH v5 1/5] gdb: make gdbarch store a vector of frame unwinders Guinevere Larsen
2024-10-02 21:49 ` Thiago Jung Bauermann
2024-10-08 17:01 ` Guinevere Larsen
2024-10-03 18:33 ` Simon Marchi
2024-10-04 18:37 ` Tom Tromey
2024-10-12 1:34 ` Thiago Jung Bauermann
2024-10-14 18:18 ` Guinevere Larsen
2024-10-17 22:53 ` Tom Tromey
2024-10-18 17:40 ` Guinevere Larsen
2024-10-17 23:41 ` Tom Tromey
2024-10-01 18:42 ` [PATCH v5 2/5] gdb: add "unwinder class" to " Guinevere Larsen
2024-10-02 22:08 ` Thiago Jung Bauermann
2024-10-03 18:46 ` Simon Marchi
2024-10-08 18:22 ` Guinevere Larsen
2024-10-08 18:37 ` Simon Marchi
2024-10-01 18:42 ` [PATCH v5 3/5] gdb: Migrate frame unwinders to use C++ classes Guinevere Larsen
2024-10-03 0:23 ` Thiago Jung Bauermann
2024-10-09 18:16 ` Guinevere Larsen
2024-10-03 20:06 ` Simon Marchi
2024-10-04 5:21 ` Simon Marchi
2024-10-10 14:10 ` Guinevere Larsen [this message]
2024-10-10 16:28 ` Simon Marchi
2024-10-09 20:00 ` Guinevere Larsen
2024-10-01 18:42 ` [PATCH v5 4/5] gdb: introduce ability to disable frame unwinders Guinevere Larsen
2024-10-02 6:10 ` Eli Zaretskii
2024-10-04 17:57 ` Guinevere Larsen
2024-10-03 2:45 ` Thiago Jung Bauermann
2024-10-08 19:23 ` Guinevere Larsen
2024-10-06 2:51 ` Simon Marchi
2024-10-09 13:32 ` Guinevere Larsen
2024-10-09 15:38 ` Simon Marchi
2024-10-01 18:42 ` [PATCH v5 5/5] gdb/testsuite: Test for a backtrace through object without debuginfo Guinevere Larsen
2024-10-03 2:47 ` Thiago Jung Bauermann
2024-10-03 6:58 ` Gerlicher, Klaus
2024-10-09 14:56 ` Guinevere Larsen
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=c56bc796-7b4c-49c0-b395-e25732daa929@redhat.com \
--to=guinevere@redhat.com \
--cc=blarsen@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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