public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH 4/6] gdb: revert frame_unwind::this_id and callees to use `frame_info *`
Date: Mon, 05 Dec 2022 14:41:26 -0700	[thread overview]
Message-ID: <87cz8xjzp5.fsf@tromey.com> (raw)
In-Reply-To: <20221202180052.212745-5-simon.marchi@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Fri, 2 Dec 2022 13:00:50 -0500")

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> So, this patch started out as changing the prototype of
Simon> frame_unwind::this_id and adjusting callees recursively until the code
Simon> compiled again.

Simon> The question is: doesn't this defeat the purpose of frame_info_ptr?  I
Simon> think it depends on what we decide the purpose of frame_info_ptr is.

Simon>  1. catch accesses to stale frame_info ptr (and assert if so)
Simon>  2. reinflate frame_info objects automatically.

Simon> Right now, it does #1.  My goal is to make it to #2.  I think that is
Simon> more in line with the original "reinflatable frames" idea, and in
Simon> general more useful.

To be clear, my goal in doing this was to try to eliminate the bug where
a frame_info pointer is held across a frame cache reinit.  From my
perspective, both of these approaches satisfy that goal, so the idea of
this change seems completely fine.

Simon> And since those frames whose id is being computed
Simon> are by definition not reinflatable (you need to id to reinflate), it's
Simon> not really useful to have frame_info_ptr on code paths that deal with
Simon> frames whose id is currently being computed.  Reinflation only really
Simon> makes sense for the "users" of the frame API, those who receive a frame
Simon> with a computed id.  And by experience, this is where the "using stale
Simon> frame_info" bugs happen, a user holding a frame_info across a target
Simon> resumption.

Basically I looked into this and it seemed difficult, so I gave up.
And, a simpler approach didn't work.  But, you managed it :-) So kudos!

I think a good long run goal would be if frame_id and frame_info_ptr
were generally merged.  That is, the "using" code should only ever need
to touch a frame_info_ptr.  I don't know if this is really feasible, but
it would be another step toward making the API simpler to use and less
buggy.

Simon> Now, we could have two separate class frame_info wrapper classes, one
Simon> that is today's frame_info_ptr, whose goal is just to catch uses of
Simon> stale frame_info objects, and one that is the one at the end of this
Simon> series, whose goal is to do automatic reinflation.

I would say the default choice should be a single class, unless for some
reason it's too expensive.

Tom

  reply	other threads:[~2022-12-05 21:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 18:00 [PATCH 0/6] Make frame_info_ptr automatic Simon Marchi
2022-12-02 18:00 ` [PATCH 1/6] gdb: add invalidate_selected_frame function Simon Marchi
2022-12-07 14:09   ` Bruno Larsen
2022-12-07 16:54     ` Simon Marchi
2022-12-02 18:00 ` [PATCH 2/6] gdb: make it possible to restore selected user-created frames Simon Marchi
2022-12-08  9:25   ` Bruno Larsen
2022-12-08 20:53     ` Simon Marchi
2022-12-12 11:14       ` Bruno Larsen
2022-12-02 18:00 ` [PATCH 3/6] gdb: make user-created frames reinflatable Simon Marchi
2022-12-12 11:32   ` Bruno Larsen
2022-12-12 13:17     ` Simon Marchi
2022-12-12 13:33       ` Bruno Larsen
2022-12-12 13:45         ` Simon Marchi
2022-12-02 18:00 ` [PATCH 4/6] gdb: revert frame_unwind::this_id and callees to use `frame_info *` Simon Marchi
2022-12-05 21:41   ` Tom Tromey [this message]
2022-12-07 16:52     ` Simon Marchi
2022-12-12 13:17   ` Bruno Larsen
2022-12-12 13:26     ` Simon Marchi
2022-12-02 18:00 ` [PATCH 5/6] gdb: make frame_info_ptr grab frame level and id on construction Simon Marchi
2022-12-08  8:51   ` Bruno Larsen
2022-12-08 20:57     ` Simon Marchi
2022-12-02 18:00 ` [PATCH 6/6] gdb: make frame_info_ptr auto-reinflatable Simon Marchi

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=87cz8xjzp5.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).