public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 25/31] Use read_var_value in read_frame_arg and read_frame_local
Date: Sun, 05 Nov 2023 11:12:03 -0700	[thread overview]
Message-ID: <20231105-split-objfile-2023-bound-sym-october-v2-25-dbd2d158bbc3@tromey.com> (raw)
In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com>

This changes read_frame_arg and read_frame_local to take a
block_symbol and to use the new read_var_value overload.k
---
 gdb/frame.h                 |  6 +++---
 gdb/mi/mi-cmd-stack.c       | 20 ++++++++++----------
 gdb/python/py-framefilter.c |  8 ++++----
 gdb/stack.c                 | 27 ++++++++++++++-------------
 4 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/gdb/frame.h b/gdb/frame.h
index 0f1640c4a68..7c664c7cea8 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -931,7 +931,7 @@ extern frame_print_options user_frame_print_options;
 struct frame_arg
 {
   /* Symbol for this parameter used for example for its name.  */
-  struct symbol *sym = nullptr;
+  block_symbol sym = {};
 
   /* Value of the parameter.  It is NULL if ERROR is not NULL; if both VAL and
      ERROR are NULL this parameter's value should not be printed.  */
@@ -954,10 +954,10 @@ struct frame_arg
 };
 
 extern void read_frame_arg (const frame_print_options &fp_opts,
-			    symbol *sym, frame_info_ptr frame,
+			    block_symbol sym, frame_info_ptr frame,
 			    struct frame_arg *argp,
 			    struct frame_arg *entryargp);
-extern void read_frame_local (struct symbol *sym, frame_info_ptr frame,
+extern void read_frame_local (block_symbol sym, frame_info_ptr frame,
 			      struct frame_arg *argp);
 
 extern void info_args_command (const char *, int);
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index e473be7d465..9a53bac92e7 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -521,18 +521,18 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 
   string_file stb;
 
-  stb.puts (arg->sym->print_name ());
+  stb.puts (arg->sym.symbol->print_name ());
   if (arg->entry_kind == print_entry_values_only)
     stb.puts ("@entry");
   uiout->field_stream ("name", stb);
 
-  if (what == all && arg->sym->is_argument ())
+  if (what == all && arg->sym.symbol->is_argument ())
     uiout->field_signed ("arg", 1);
 
   if (values == PRINT_SIMPLE_VALUES)
     {
-      check_typedef (arg->sym->type ());
-      type_print (arg->sym->type (), "", &stb, -1);
+      check_typedef (arg->sym.symbol->type ());
+      type_print (arg->sym.symbol->type (), "", &stb, -1);
       uiout->field_stream ("type", stb);
     }
 
@@ -549,7 +549,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	      get_no_prettyformat_print_options (&opts);
 	      opts.deref_ref = true;
 	      common_val_print (arg->val, &stb, 0, &opts,
-				language_def (arg->sym->language ()));
+				language_def (arg->sym.symbol->language ()));
 	    }
 	  catch (const gdb_exception_error &except)
 	    {
@@ -632,15 +632,15 @@ list_args_or_locals (const frame_print_options &fp_opts,
 	    }
 	  if (print_me)
 	    {
-	      struct symbol *sym2;
+	      block_symbol sym2;
 	      struct frame_arg arg, entryarg;
 
 	      if (sym->is_argument ())
 		sym2 = lookup_symbol_search_name (sym->search_name (),
-						  block, VAR_DOMAIN).symbol;
+						  block, VAR_DOMAIN);
 	      else
-		sym2 = sym;
-	      gdb_assert (sym2 != NULL);
+		sym2 = { sym, block };
+	      gdb_assert (sym2.symbol != nullptr);
 
 	      arg.sym = sym2;
 	      arg.entry_kind = print_entry_values_no;
@@ -650,7 +650,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
 	      switch (values)
 		{
 		case PRINT_SIMPLE_VALUES:
-		  if (!mi_simple_type_p (sym2->type ()))
+		  if (!mi_simple_type_p (sym2.symbol->type ()))
 		    break;
 		  /* FALLTHROUGH */
 
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 07b30a587b1..b214e82628f 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -312,7 +312,7 @@ py_print_single_arg (struct ui_out *out,
     {
       if (fa->val == NULL && fa->error == NULL)
 	return;
-      language = language_def (fa->sym->language ());
+      language = language_def (fa->sym.symbol->language ());
       val = fa->val;
     }
   else
@@ -340,12 +340,12 @@ py_print_single_arg (struct ui_out *out,
     {
       string_file stb;
 
-      gdb_puts (fa->sym->print_name (), &stb);
+      gdb_puts (fa->sym.symbol->print_name (), &stb);
       if (fa->entry_kind == print_entry_values_compact)
 	{
 	  stb.puts ("=");
 
-	  gdb_puts (fa->sym->print_name (), &stb);
+	  gdb_puts (fa->sym.symbol->print_name (), &stb);
 	}
       if (fa->entry_kind == print_entry_values_only
 	  || fa->entry_kind == print_entry_values_compact)
@@ -472,7 +472,7 @@ enumerate_args (PyObject *iter,
 	    }
 
 	  read_frame_arg (user_frame_print_options,
-			  sym, frame, &arg, &entryarg);
+			  bsym, frame, &arg, &entryarg);
 
 	  /* The object has not provided a value, so this is a frame
 	     argument to be read by GDB.  In this case we have to
diff --git a/gdb/stack.c b/gdb/stack.c
index f744baad61a..8d72949006c 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -428,14 +428,14 @@ print_frame_arg (const frame_print_options &fp_opts,
 
   annotate_arg_emitter arg_emitter;
   ui_out_emit_tuple tuple_emitter (uiout, NULL);
-  gdb_puts (arg->sym->print_name (), &stb);
+  gdb_puts (arg->sym.symbol->print_name (), &stb);
   if (arg->entry_kind == print_entry_values_compact)
     {
       /* It is OK to provide invalid MI-like stream as with
 	 PRINT_ENTRY_VALUE_COMPACT we never use MI.  */
       stb.puts ("=");
 
-      gdb_puts (arg->sym->print_name (), &stb);
+      gdb_puts (arg->sym.symbol->print_name (), &stb);
     }
   if (arg->entry_kind == print_entry_values_only
       || arg->entry_kind == print_entry_values_compact)
@@ -472,7 +472,7 @@ print_frame_arg (const frame_print_options &fp_opts,
 	      /* Use the appropriate language to display our symbol, unless the
 		 user forced the language to a specific language.  */
 	      if (language_mode == language_mode_auto)
-		language = language_def (arg->sym->language ());
+		language = language_def (arg->sym.symbol->language ());
 	      else
 		language = current_language;
 
@@ -503,7 +503,7 @@ print_frame_arg (const frame_print_options &fp_opts,
    exception.  */
 
 void
-read_frame_local (struct symbol *sym, frame_info_ptr frame,
+read_frame_local (block_symbol sym, frame_info_ptr frame,
 		  struct frame_arg *argp)
 {
   argp->sym = sym;
@@ -512,7 +512,7 @@ read_frame_local (struct symbol *sym, frame_info_ptr frame,
 
   try
     {
-      argp->val = read_var_value (sym, NULL, frame);
+      argp->val = read_var_value (sym, frame);
     }
   catch (const gdb_exception_error &except)
     {
@@ -525,7 +525,7 @@ read_frame_local (struct symbol *sym, frame_info_ptr frame,
 
 void
 read_frame_arg (const frame_print_options &fp_opts,
-		symbol *sym, frame_info_ptr frame,
+		block_symbol bsym, frame_info_ptr frame,
 		struct frame_arg *argp, struct frame_arg *entryargp)
 {
   struct value *val = NULL, *entryval = NULL;
@@ -537,7 +537,7 @@ read_frame_arg (const frame_print_options &fp_opts,
     {
       try
 	{
-	  val = read_var_value (sym, NULL, frame);
+	  val = read_var_value (bsym, frame);
 	}
       catch (const gdb_exception_error &except)
 	{
@@ -546,6 +546,7 @@ read_frame_arg (const frame_print_options &fp_opts,
 	}
     }
 
+  symbol *sym = bsym.symbol;
   if (SYMBOL_COMPUTED_OPS (sym) != NULL
       && SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
       && fp_opts.print_entry_values != print_entry_values_no
@@ -661,7 +662,7 @@ read_frame_arg (const frame_print_options &fp_opts,
 
 	  try
 	    {
-	      val = read_var_value (sym, NULL, frame);
+	      val = read_var_value (bsym, frame);
 	    }
 	  catch (const gdb_exception_error &except)
 	    {
@@ -687,7 +688,7 @@ read_frame_arg (const frame_print_options &fp_opts,
       val_error = NULL;
     }
 
-  argp->sym = sym;
+  argp->sym = bsym;
   argp->val = val;
   argp->error.reset (val_error ? xstrdup (val_error) : NULL);
   if (!val && !val_error)
@@ -702,7 +703,7 @@ read_frame_arg (const frame_print_options &fp_opts,
   else
     argp->entry_kind = print_entry_values_no;
 
-  entryargp->sym = sym;
+  entryargp->sym = bsym;
   entryargp->val = entryval;
   entryargp->error.reset (entryval_error ? xstrdup (entryval_error) : NULL);
   if (!entryval && !entryval_error)
@@ -871,13 +872,13 @@ print_frame_args (const frame_print_options &fp_opts,
 
 	  if (!print_args)
 	    {
-	      arg.sym = sym;
+	      arg.sym = { sym, b };
 	      arg.entry_kind = print_entry_values_no;
-	      entryarg.sym = sym;
+	      entryarg.sym = { sym, b };
 	      entryarg.entry_kind = print_entry_values_no;
 	    }
 	  else
-	    read_frame_arg (fp_opts, sym, frame, &arg, &entryarg);
+	    read_frame_arg (fp_opts, { sym, b }, frame, &arg, &entryarg);
 
 	  if (arg.entry_kind != print_entry_values_only)
 	    print_frame_arg (fp_opts, &arg);

-- 
2.41.0


  parent reply	other threads:[~2023-11-05 18:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 18:11 [PATCH v2 00/31] Baby step for objfile splitting Tom Tromey
2023-11-05 18:11 ` [PATCH v2 01/31] Introduce block-symbol.h Tom Tromey
2023-11-05 18:11 ` [PATCH v2 02/31] Add block_symbol::address Tom Tromey
2023-11-05 18:11 ` [PATCH v2 03/31] Add bound_symbol Tom Tromey
2023-11-05 18:11 ` [PATCH v2 04/31] Easy conversions to use block_symbol::address Tom Tromey
2023-11-05 18:11 ` [PATCH v2 05/31] Use block_symbol::address in ada-tasks.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 06/31] Use block_symbol::address in printcmd.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 07/31] Use bound_symbol::address in tracepoint.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 08/31] Use block_symbol::address " Tom Tromey
2023-11-05 18:11 ` [PATCH v2 09/31] Use block_symbol::address in ax-gdb.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 10/31] Use block_symbol::address in linespec.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 11/31] Use block_symbol::address in ada-lang.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 12/31] Use bound_symbol::address in symmisc.c Tom Tromey
2023-11-05 18:11 ` [PATCH v2 13/31] Introduce read_var_value overload Tom Tromey
2023-11-05 18:11 ` [PATCH v2 14/31] Use read_var_value in gdb/compile Tom Tromey
2023-11-05 18:11 ` [PATCH v2 15/31] Return a block_symbol from find_pc_sect_function Tom Tromey
2023-11-05 18:11 ` [PATCH v2 16/31] Use read_var_value overload in finish_command_fsm Tom Tromey
2023-11-05 18:11 ` [PATCH v2 17/31] Use block_symbol in overload-handling code Tom Tromey
2023-11-05 18:11 ` [PATCH v2 18/31] Change evaluate_var_value to accept a block_symbol Tom Tromey
2023-11-05 18:11 ` [PATCH v2 19/31] Change value_of_variable to take " Tom Tromey
2023-11-05 18:11 ` [PATCH v2 20/31] Return a block_symbol from get_frame_function Tom Tromey
2023-11-05 18:11 ` [PATCH v2 21/31] Use read_var_value overload in return_command Tom Tromey
2023-11-05 18:12 ` [PATCH v2 22/31] Use read_var_value overload in py-finishbreakpoint.c Tom Tromey
2023-11-05 18:12 ` [PATCH v2 23/31] Use read_var_value overload in py-framefilter.c Tom Tromey
2023-11-05 18:12 ` [PATCH v2 24/31] Use read_var_value overload in Guile Tom Tromey
2023-11-05 18:12 ` Tom Tromey [this message]
2023-11-05 18:12 ` [PATCH v2 26/31] Change print_variable_and_value to take a block_symbol Tom Tromey
2023-11-05 18:12 ` [PATCH v2 27/31] Change find_frame_funname to return " Tom Tromey
2023-11-05 18:12 ` [PATCH v2 28/31] Change btrace_function::sym to " Tom Tromey
2023-11-05 18:12 ` [PATCH v2 29/31] Use read_var_value overload in Python Tom Tromey
2023-11-05 18:12 ` [PATCH v2 30/31] Remove the old read_var_value Tom Tromey
2023-11-05 18:12 ` [PATCH v2 31/31] Change language_defn::read_var_value to accept block_symbol Tom Tromey
2023-11-06 15:16 ` [PATCH v2 00/31] Baby step for objfile splitting Andrew Burgess
2023-11-07  3:36   ` Tom Tromey
2023-11-07 11:06     ` Andrew Burgess

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=20231105-split-objfile-2023-bound-sym-october-v2-25-dbd2d158bbc3@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).