[binutils-gdb] Remove some frame invalidation code

Tom Tromey tromey@sourceware.org
Tue Oct 31 03:47:29 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1f9e9ea5b7cd1554db5a5e9da92a6882f1cce40e

commit 1f9e9ea5b7cd1554db5a5e9da92a6882f1cce40e
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Oct 28 11:46:33 2023 -0600

    Remove some frame invalidation code
    
    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.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 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)


More information about the Gdb-cvs mailing list