public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/6] gdb: add invalidate_selected_frame function
Date: Wed, 7 Dec 2022 15:09:20 +0100	[thread overview]
Message-ID: <4e408f03-21d4-fb9e-ac63-850428a03718@redhat.com> (raw)
In-Reply-To: <20221202180052.212745-2-simon.marchi@polymtl.ca>

On 02/12/2022 19:00, Simon Marchi via Gdb-patches wrote:
> Instead of using `select_frame (nullptr)` to invalidate the selected
> frame, introduce a function to do that.  There is no change in behavior,
> but it makes the intent a bit clearer.  It also allows adding an assert
> in select_frame that fi is not nullptr, so it avoids passing nullptr by
> mistake.

LGTM, and doesn't introduce any regressions

Reviewed-By: Bruno Larsen <blarsen@redhat.com>

-- 
Cheers,
Bruno

>
> Change-Id: I61643f46bc8eca428334513ebdaadab63997bdd0
> ---
>   gdb/frame.c | 16 ++++++++++++++--
>   gdb/frame.h |  3 +--
>   2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/frame.c b/gdb/frame.c
> index b4079ef833e8..6a6d968b9a97 100644
> --- a/gdb/frame.c
> +++ b/gdb/frame.c
> @@ -1836,11 +1836,23 @@ deprecated_safe_get_selected_frame (void)
>     return get_selected_frame (NULL);
>   }
>   
> -/* Select frame FI (or NULL - to invalidate the selected frame).  */
> +/* Invalidate the selected frame.  */
> +
> +static void
> +invalidate_selected_frame ()
> +{
> +  selected_frame = nullptr;
> +  selected_frame_level = -1;
> +  selected_frame_id = null_frame_id;
> +}
> +
> +/* See frame.h.  */
>   
>   void
>   select_frame (frame_info_ptr fi)
>   {
> +  gdb_assert (fi != nullptr);
> +
>     selected_frame = fi;
>     selected_frame_level = frame_relative_level (fi);
>     if (selected_frame_level == 0)
> @@ -2012,7 +2024,7 @@ reinit_frame_cache (void)
>       annotate_frames_invalid ();
>   
>     sentinel_frame = NULL;		/* Invalidate cache */
> -  select_frame (NULL);
> +  invalidate_selected_frame ();
>     frame_stash_invalidate ();
>   
>     for (frame_info_ptr &iter : frame_info_ptr::frame_list)
> diff --git a/gdb/frame.h b/gdb/frame.h
> index 100ab1fe48eb..cf8bbc6a52bd 100644
> --- a/gdb/frame.h
> +++ b/gdb/frame.h
> @@ -239,8 +239,7 @@ extern void reinit_frame_cache (void);
>      and then return that thread's previously selected frame.  */
>   extern frame_info_ptr get_selected_frame (const char *message = nullptr);
>   
> -/* Select a specific frame.  NULL implies re-select the inner most
> -   frame.  */
> +/* Select a specific frame.  */
>   extern void select_frame (frame_info_ptr);
>   
>   /* Save the frame ID and frame level of the selected frame in FRAME_ID


  reply	other threads:[~2022-12-07 14:09 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 [this message]
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
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=4e408f03-21d4-fb9e-ac63-850428a03718@redhat.com \
    --to=blarsen@redhat.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).