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 17/30] Change evaluate_var_value to accept a block_symbol
Date: Sun, 29 Oct 2023 17:23:38 -0600	[thread overview]
Message-ID: <20231029-split-objfile-2023-bound-sym-october-v1-17-612531df2734@tromey.com> (raw)
In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com>

This change evaluate_var_value to accept a block_symbol, preparing
some code to use the new read_var_value overload.
---
 gdb/ada-lang.c |  4 +---
 gdb/eval.c     | 20 ++++++++------------
 gdb/value.h    |  3 +--
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index aeb21e0c15c..8f2fc5410d4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10828,9 +10828,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
 					    struct expression *exp,
 					    enum noside noside)
 {
-  value *val = evaluate_var_value (noside,
-				   std::get<0> (m_storage).block,
-				   std::get<0> (m_storage).symbol);
+  value *val = evaluate_var_value (noside, std::get<0> (m_storage));
 
   val = ada_value_cast (expect_type, val);
 
diff --git a/gdb/eval.c b/gdb/eval.c
index ba09599b28a..0f5e3c18a05 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -517,7 +517,7 @@ type_instance_operation::evaluate (struct type *expect_type,
 /* Helper for evaluating an OP_VAR_VALUE.  */
 
 value *
-evaluate_var_value (enum noside noside, const block *blk, symbol *var)
+evaluate_var_value (enum noside noside, block_symbol var)
 {
   /* JYG: We used to just return value::zero of the symbol type if
      we're asked to avoid side effects.  Otherwise we return
@@ -532,7 +532,7 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var)
 
   try
     {
-      ret = value_of_variable (var, blk);
+      ret = value_of_variable (var.symbol, var.block);
     }
 
   catch (const gdb_exception_error &except)
@@ -540,7 +540,7 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var)
       if (noside != EVAL_AVOID_SIDE_EFFECTS)
 	throw;
 
-      ret = value::zero (var->type (), not_lval);
+      ret = value::zero (var.symbol->type (), not_lval);
     }
 
   return ret;
@@ -558,7 +558,7 @@ var_value_operation::evaluate (struct type *expect_type,
   symbol *var = std::get<0> (m_storage).symbol;
   if (var->type ()->code () == TYPE_CODE_ERROR)
     error_unknown_type (var->print_name ());
-  return evaluate_var_value (noside, std::get<0> (m_storage).block, var);
+  return evaluate_var_value (noside, std::get<0> (m_storage));
 }
 
 } /* namespace expr */
@@ -700,8 +700,7 @@ var_value_operation::evaluate_funcall (struct type *expect_type,
 
   if (symp.symbol->type ()->code () == TYPE_CODE_ERROR)
     error_unknown_type (symp.symbol->print_name ());
-  value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block,
-				      symp.symbol);
+  value *callee = evaluate_var_value (noside, symp);
 
   return evaluate_subexp_do_call (exp, noside, callee, argvec,
 				  nullptr, expect_type);
@@ -1108,7 +1107,7 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp,
   struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL);
   if (sym.symbol == NULL)
     error (_("No symbol \"%s\" in specified context."), var);
-  return evaluate_var_value (noside, sym.block, sym.symbol);
+  return evaluate_var_value (noside, sym);
 }
 
 /* Helper function that implements the body of OP_REGISTER.  */
@@ -2326,8 +2325,7 @@ adl_func_operation::evaluate (struct type *expect_type,
 		       nullptr, &symp, nullptr, 0, noside);
   if (symp.symbol->type ()->code () == TYPE_CODE_ERROR)
     error_unknown_type (symp.symbol->print_name ());
-  value *callee = evaluate_var_value (noside, std::get<1> (m_storage),
-				      symp.symbol);
+  value *callee = evaluate_var_value (noside, symp);
   return evaluate_subexp_do_call (exp, noside, callee, args,
 				  nullptr, expect_type);
 
@@ -2854,9 +2852,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
 					struct expression *exp,
 					enum noside noside)
 {
-  value *val = evaluate_var_value (noside,
-				   std::get<0> (m_storage).block,
-				   std::get<0> (m_storage).symbol);
+  value *val = evaluate_var_value (noside, std::get<0> (m_storage));
 
   val = value_cast (to_type, val);
 
diff --git a/gdb/value.h b/gdb/value.h
index 6f0b61a853d..37c07a41205 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1344,8 +1344,7 @@ extern int using_struct_return (struct gdbarch *gdbarch,
 				struct value *function,
 				struct type *value_type);
 
-extern value *evaluate_var_value (enum noside noside, const block *blk,
-				  symbol *var);
+extern value *evaluate_var_value (enum noside noside, block_symbol var);
 
 extern value *evaluate_var_msym_value (enum noside noside,
 				       struct objfile *objfile,

-- 
2.41.0


  parent reply	other threads:[~2023-10-29 23:23 UTC|newest]

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

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=20231029-split-objfile-2023-bound-sym-october-v1-17-612531df2734@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).