public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Bernd Edlinger <bernd.edlinger@hotmail.de>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove unnecessary get_current_frame calls from infrun.c
Date: Mon, 01 Apr 2024 10:07:14 -0600	[thread overview]
Message-ID: <8734s5awy5.fsf@tromey.com> (raw)
In-Reply-To: <66c53f57-006a-4a2f-bce7-bb04d7b58566@simark.ca> (Simon Marchi's message of "Sun, 31 Mar 2024 22:52:42 -0400")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> -	  /* Re-fetch current thread's frame in case that invalidated
>> -	     the frame cache.  */
>> -	  frame = get_current_frame ();
>> -	  gdbarch = get_frame_arch (frame);

Simon> For `frame` I agree, I think we can remove it.  But I'm wondering about
Simon> `gdbarch`.  Before we had `frame_info_ptr`, even if `frame` got
Simon> invalidated, it didn't seem necessary to reset `gdbarch`.  Are there
Simon> cases where you would get a different value for `gdbarch` as it
Simon> currently holds?  I can't think of any.  I'm leaning towards saying that
Simon> this is fine.

I think the main danger in this patch is if the current comments are
wrong -- that is, when it is referring to something reinitializing the
frame cache, is that correct?  Or could the inferior be restarted
somewhere in here, resulting in a different current frame?  In the
latter case get_current_frame definitely has to be called again, the old
frame may not even exist.

I don't think it's possible for the gdbarch to change mid-frame, only
between frames.  This capability has been desired a few times (x86
boot-up apparently switches modes or something), but patches have never
been supplied.

So, I tend to think not resetting gdbarch is fine.

Tom

  parent reply	other threads:[~2024-04-01 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-31 10:50 Bernd Edlinger
2024-04-01  2:52 ` Simon Marchi
2024-04-01 11:45   ` Bernd Edlinger
2024-04-01 16:07   ` Tom Tromey [this message]
2024-04-01 17:00     ` Bernd Edlinger
2024-04-26 16:31 ` Tom Tromey
2024-04-26 17:47   ` Bernd Edlinger

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=8734s5awy5.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=bernd.edlinger@hotmail.de \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).