public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Pass a frame to value_at_lazy and value_from_contents_and_address Date: Wed, 29 Mar 2023 16:28:14 +0000 (GMT) [thread overview] Message-ID: <20230329162814.317A3385841C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=168f9f95995d7958d8ae35a54c0691f46961c209 commit 168f9f95995d7958d8ae35a54c0691f46961c209 Author: Tom Tromey <tromey@adacore.com> Date: Wed Mar 1 10:33:20 2023 -0700 Pass a frame to value_at_lazy and value_from_contents_and_address This patch adds a 'frame' parameter to value_at_lazy and ensures that it is passed down to the call to resolve_dynamic_type. This required also adding a frame parameter to value_from_contents_and_address. Nothing passes this parameter to value_at_lazy yet, so this patch should have no visible effect. Diff: --- gdb/valops.c | 11 ++++++----- gdb/value.c | 6 ++++-- gdb/value.h | 14 ++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gdb/valops.c b/gdb/valops.c index 02747543a53..d002c9dca9b 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -980,14 +980,15 @@ value_one (struct type *type) e.g. in case the type is a variable length array. */ static struct value * -get_value_at (struct type *type, CORE_ADDR addr, int lazy) +get_value_at (struct type *type, CORE_ADDR addr, frame_info_ptr frame, + int lazy) { struct value *val; if (check_typedef (type)->code () == TYPE_CODE_VOID) error (_("Attempt to dereference a generic pointer.")); - val = value_from_contents_and_address (type, NULL, addr); + val = value_from_contents_and_address (type, NULL, addr, frame); if (!lazy) val->fetch_lazy (); @@ -1013,7 +1014,7 @@ get_value_at (struct type *type, CORE_ADDR addr, int lazy) struct value * value_at (struct type *type, CORE_ADDR addr) { - return get_value_at (type, addr, 0); + return get_value_at (type, addr, nullptr, 0); } /* See value.h. */ @@ -1032,9 +1033,9 @@ value_at_non_lval (struct type *type, CORE_ADDR addr) e.g. in case the type is a variable length array. */ struct value * -value_at_lazy (struct type *type, CORE_ADDR addr) +value_at_lazy (struct type *type, CORE_ADDR addr, frame_info_ptr frame) { - return get_value_at (type, addr, 1); + return get_value_at (type, addr, frame, 1); } void diff --git a/gdb/value.c b/gdb/value.c index 7cb15ff54db..757f92572aa 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3543,12 +3543,14 @@ value_from_contents_and_address_unresolved (struct type *type, struct value * value_from_contents_and_address (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address) + CORE_ADDR address, + frame_info_ptr frame) { gdb::array_view<const gdb_byte> view; if (valaddr != nullptr) view = gdb::make_array_view (valaddr, type->length ()); - struct type *resolved_type = resolve_dynamic_type (type, view, address); + struct type *resolved_type = resolve_dynamic_type (type, view, address, + &frame); struct type *resolved_type_no_typedef = check_typedef (resolved_type); struct value *v; diff --git a/gdb/value.h b/gdb/value.h index 1b4eff22f37..e13f92c397b 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1084,7 +1084,13 @@ extern struct value *value_from_component (struct value *, struct type *, extern struct value *value_from_mpz (struct type *type, const gdb_mpz &v); extern struct value *value_at (struct type *type, CORE_ADDR addr); -extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); + +/* Return a new value given a type and an address. The new value is + lazy. If FRAME is given, it is used when resolving dynamic + properties. */ + +extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr, + frame_info_ptr frame = nullptr); /* Like value_at, but ensures that the result is marked not_lval. This can be important if the memory is "volatile". */ @@ -1092,9 +1098,9 @@ extern struct value *value_at_non_lval (struct type *type, CORE_ADDR addr); extern struct value *value_from_contents_and_address_unresolved (struct type *, const gdb_byte *, CORE_ADDR); -extern struct value *value_from_contents_and_address (struct type *, - const gdb_byte *, - CORE_ADDR); +extern struct value *value_from_contents_and_address + (struct type *, const gdb_byte *, CORE_ADDR, + frame_info_ptr frame = nullptr); extern struct value *value_from_contents (struct type *, const gdb_byte *); extern struct value *default_value_from_register (struct gdbarch *gdbarch,
reply other threads:[~2023-03-29 16:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230329162814.317A3385841C@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).