public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Remove some frame invalidation code
Date: Mon, 30 Oct 2023 16:30:01 -0600	[thread overview]
Message-ID: <20231030223001.1714967-1-tom@tromey.com> (raw)

I stumbled across a few spots that mention that a function
"invalidates frame" and also assignments of NULL to a frame_info_ptr.
This code isn't harmful, but is also unnecessary since the
introduction of frame_info_ptr -- nowadays frame invalidations are
handled automatically.

Regression tested on x86-64 Fedora 38.
---
 gdb/breakpoint.c |  3 ---
 gdb/printcmd.c   |  8 +-------
 gdb/stack.c      | 11 ++---------
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 828c99cabc0..fe09dbcbeee 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10952,9 +10952,6 @@ until_break_command (const char *arg, int from_tty, int anywhere)
       lj_deleter.emplace (thread);
     }
 
-  /* set_momentary_breakpoint could invalidate FRAME.  */
-  frame = NULL;
-
   /* If the user told us to continue until a specified location, we
      don't specify a frame at which we need to stop.  Otherwise,
      specify the selected frame, because we want to stop only at the
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index b9b6a3b8648..06cc5316eec 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2391,9 +2391,7 @@ clear_dangling_display_expressions (struct objfile *objfile)
    struct symbol.  NAME is the name to print; if NULL then VAR's print
    name will be used.  STREAM is the ui_file on which to print the
    value.  INDENT specifies the number of indent levels to print
-   before printing the variable name.
-
-   This function invalidates FRAME.  */
+   before printing the variable name.  */
 
 void
 print_variable_and_value (const char *name, struct symbol *var,
@@ -2420,10 +2418,6 @@ print_variable_and_value (const char *name, struct symbol *var,
       get_user_print_options (&opts);
       opts.deref_ref = true;
       common_val_print_checked (val, stream, indent, &opts, current_language);
-
-      /* common_val_print invalidates FRAME when a pretty printer calls inferior
-	 function.  */
-      frame = NULL;
     }
   catch (const gdb_exception_error &except)
     {
diff --git a/gdb/stack.c b/gdb/stack.c
index 0b35d62f82f..39dcefa87b8 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2326,9 +2326,7 @@ prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
    If T_REGEXP is not NULL, only print local variables whose type
    matches T_REGEXP.
    If no local variables have been printed and !QUIET, prints a message
-   explaining why no local variables could be printed.
-
-   This function will invalidate FRAME.  */
+   explaining why no local variables could be printed.  */
 
 static void
 print_frame_local_vars (frame_info_ptr frame,
@@ -2490,9 +2488,7 @@ iterate_over_block_arg_vars (const struct block *b,
    If T_REGEXP is not NULL, only print argument variables whose type
    matches T_REGEXP.
    If no argument variables have been printed and !QUIET, prints a message
-   explaining why no argument variables could be printed.
-
-   This function will invalidate FRAME.  */
+   explaining why no argument variables could be printed.  */
 
 static void
 print_frame_arg_vars (frame_info_ptr frame,
@@ -2531,9 +2527,6 @@ print_frame_arg_vars (frame_info_ptr frame,
 
   iterate_over_block_arg_vars (func->value_block (), cb_data);
 
-  /* do_print_variable_and_value invalidates FRAME.  */
-  frame = NULL;
-
   if (!cb_data.values_printed && !quiet)
     {
       if (regexp == NULL && t_regexp == NULL)
-- 
2.41.0


             reply	other threads:[~2023-10-30 22:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 22:30 Tom Tromey [this message]
2023-10-31  1:23 ` 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=20231030223001.1714967-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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).