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] Turn value_stack and set_value_stack functions into methods Date: Mon, 13 Feb 2023 22:28:35 +0000 (GMT) [thread overview] Message-ID: <20230213222835.6FB553858D1E@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c8580184bbd1af58769d143b23d254737b08de9d commit c8580184bbd1af58769d143b23d254737b08de9d Author: Tom Tromey <tom@tromey.com> Date: Tue Jan 31 11:11:17 2023 -0700 Turn value_stack and set_value_stack functions into methods This changes the value_stack and set_value_stack functions to be methods of value. Approved-By: Simon Marchi <simon.marchi@efficios.com> Diff: --- gdb/dwarf2/expr.c | 2 +- gdb/frame-unwind.c | 2 +- gdb/valops.c | 2 +- gdb/value.c | 14 +------------- gdb/value.h | 9 ++++++--- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 0274372a0c4..292ac8bb559 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -1005,7 +1005,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type, retval = value_at_lazy (subobj_type, address + subobj_offset); if (in_stack_memory) - set_value_stack (retval, 1); + retval->set_stack (1); } break; diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 76601faa479..d3baedb8a6f 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -289,7 +289,7 @@ frame_unwind_got_memory (frame_info_ptr frame, int regnum, CORE_ADDR addr) struct gdbarch *gdbarch = frame_unwind_arch (frame); struct value *v = value_at_lazy (register_type (gdbarch, regnum), addr); - set_value_stack (v, 1); + v->set_stack (1); return v; } diff --git a/gdb/valops.c b/gdb/valops.c index 1823b0bc1d6..7e3fca30af2 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1376,7 +1376,7 @@ value_repeat (struct value *arg1, int count) VALUE_LVAL (val) = lval_memory; set_value_address (val, value_address (arg1)); - read_value_memory (val, 0, value_stack (val), value_address (val), + read_value_memory (val, 0, val->stack (), value_address (val), value_contents_all_raw (val).data (), type_length_units (val->enclosing_type ())); diff --git a/gdb/value.c b/gdb/value.c index cb169019028..b09ee9bd2d4 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1291,18 +1291,6 @@ value_contents_copy (struct value *dst, LONGEST dst_offset, value_contents_copy_raw (dst, dst_offset, src, src_offset, length); } -int -value_stack (const struct value *value) -{ - return value->m_stack; -} - -void -set_value_stack (struct value *value, int val) -{ - value->m_stack = val; -} - gdb::array_view<const gdb_byte> value_contents (struct value *value) { @@ -3886,7 +3874,7 @@ value_fetch_lazy_memory (struct value *val) gdb_assert (len >= 0); if (len > 0) - read_value_memory (val, 0, value_stack (val), addr, + read_value_memory (val, 0, val->stack (), addr, value_contents_all_raw (val).data (), len); } diff --git a/gdb/value.h b/gdb/value.h index 80946c0a0c9..73783f8c3a5 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -295,6 +295,12 @@ struct value void set_enclosing_type (struct type *new_type); + int stack () const + { return m_stack; } + + void set_stack (int val) + { m_stack = val; } + /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -568,9 +574,6 @@ extern const struct lval_funcs *value_computed_funcs (const struct value *); extern void *value_computed_closure (const struct value *value); -extern int value_stack (const struct value *); -extern void set_value_stack (struct value *value, int val); - /* Throw an error complaining that the value has been optimized out. */
reply other threads:[~2023-02-13 22: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=20230213222835.6FB553858D1E@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).