From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 31/31] Change language_defn::read_var_value to accept block_symbol
Date: Sun, 05 Nov 2023 11:12:09 -0700 [thread overview]
Message-ID: <20231105-split-objfile-2023-bound-sym-october-v2-31-dbd2d158bbc3@tromey.com> (raw)
In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com>
This changes language_defn::read_var_value to accept a block_symbol,
and to call block_symbol::address.
---
gdb/ada-lang.c | 9 ++++-----
gdb/findvar.c | 17 ++++++++---------
gdb/language.h | 14 ++++----------
3 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 6beadad568a..ad39f5d496c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13391,8 +13391,7 @@ class ada_language : public language_defn
/* Implement the "read_var_value" language_defn method for Ada. */
- struct value *read_var_value (struct symbol *var,
- const struct block *var_block,
+ struct value *read_var_value (block_symbol var,
frame_info_ptr frame) const override
{
/* The only case where default_read_var_value is not sufficient
@@ -13400,13 +13399,13 @@ class ada_language : public language_defn
if (frame != nullptr)
{
const struct block *frame_block = get_frame_block (frame, NULL);
- if (frame_block != nullptr && ada_is_renaming_symbol (var))
- return ada_read_renaming_var_value (var, frame_block);
+ if (frame_block != nullptr && ada_is_renaming_symbol (var.symbol))
+ return ada_read_renaming_var_value (var.symbol, frame_block);
}
/* This is a typical case where we expect the default_read_var_value
function to work. */
- return language_defn::read_var_value (var, var_block, frame);
+ return language_defn::read_var_value (var, frame);
}
/* See language.h. */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 4282d85425a..359024e931b 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -549,11 +549,10 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
/* See language.h. */
struct value *
-language_defn::read_var_value (struct symbol *var,
- const struct block *var_block,
- frame_info_ptr frame) const
+language_defn::read_var_value (block_symbol bvar, frame_info_ptr frame) const
{
struct value *v;
+ symbol *var = bvar.symbol;
struct type *type = var->type ();
CORE_ADDR addr;
enum symbol_needs_kind sym_need;
@@ -572,7 +571,7 @@ language_defn::read_var_value (struct symbol *var,
error (_("Cannot read `%s' without registers"), var->print_name ());
if (frame != NULL)
- frame = get_hosting_frame (var, var_block, frame);
+ frame = get_hosting_frame (var, bvar.block, frame);
if (SYMBOL_COMPUTED_OPS (var) != NULL)
return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame);
@@ -598,11 +597,11 @@ language_defn::read_var_value (struct symbol *var,
if (overlay_debugging)
{
struct objfile *var_objfile = var->objfile ();
- addr = symbol_overlayed_address (var->value_address (),
+ addr = symbol_overlayed_address (bvar.address (),
var->obj_section (var_objfile));
}
else
- addr = var->value_address ();
+ addr = bvar.address ();
/* First convert the CORE_ADDR to a function pointer type, this
ensures the gdbarch knows what type of pointer we are
@@ -635,10 +634,10 @@ language_defn::read_var_value (struct symbol *var,
case LOC_STATIC:
if (overlay_debugging)
addr
- = symbol_overlayed_address (var->value_address (),
+ = symbol_overlayed_address (bvar.address (),
var->obj_section (var->objfile ()));
else
- addr = var->value_address ();
+ addr = bvar.address ();
break;
case LOC_ARG:
@@ -790,7 +789,7 @@ read_var_value (block_symbol var, frame_info_ptr frame)
gdb_assert (lang != NULL);
- return lang->read_var_value (var.symbol, var.block, frame);
+ return lang->read_var_value (var, frame);
}
/* Install default attributes for register values. */
diff --git a/gdb/language.h b/gdb/language.h
index 6ee8f6160e1..ede720ef7c8 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -308,19 +308,13 @@ struct language_defn
struct ui_file *stream,
const value_print_options *options) const;
- /* Given a symbol VAR, the corresponding block VAR_BLOCK (if any) and a
- stack frame id FRAME, read the value of the variable and return (pointer
- to a) struct value containing the value.
-
- VAR_BLOCK is needed if there's a possibility for VAR to be outside
- FRAME. This is what happens if FRAME correspond to a nested function
- and VAR is defined in the outer function. If callers know that VAR is
- located in FRAME or is global/static, NULL can be passed as VAR_BLOCK.
+ /* Given a block_symbol VAR and a stack frame id FRAME, read the
+ value of the variable and return (pointer to a) struct value
+ containing the value.
Throw an error if the variable cannot be found. */
- virtual struct value *read_var_value (struct symbol *var,
- const struct block *var_block,
+ virtual struct value *read_var_value (block_symbol var,
frame_info_ptr frame) const;
/* Return information about whether TYPE should be passed
--
2.41.0
next prev parent reply other threads:[~2023-11-05 19:57 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 ` [PATCH v2 25/31] Use read_var_value in read_frame_arg and read_frame_local Tom Tromey
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 ` Tom Tromey [this message]
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-31-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).