From: Tom Tromey Date: Tue, 31 Jan 2023 18:11:17 +0000 (-0700) Subject: Turn value_stack and set_value_stack functions into methods X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c8580184bbd1af58769d143b23d254737b08de9d;p=binutils-gdb.git 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 --- 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 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. */