public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove some frame invalidation code
@ 2023-10-30 22:30 Tom Tromey
  2023-10-31  1:23 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2023-10-30 22:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove some frame invalidation code
  2023-10-30 22:30 [PATCH] Remove some frame invalidation code Tom Tromey
@ 2023-10-31  1:23 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2023-10-31  1:23 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches



On 2023-10-30 18:30, Tom Tromey wrote:
> 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.

LGTM, thanks.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-31  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 22:30 [PATCH] Remove some frame invalidation code Tom Tromey
2023-10-31  1:23 ` Simon Marchi

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).