diff options
-rw-r--r-- | gdb/findvar.c | 2 | ||||
-rw-r--r-- | gdb/frame.c | 7 | ||||
-rw-r--r-- | gdb/python/py-unwind.c | 2 | ||||
-rw-r--r-- | gdb/stack.c | 3 | ||||
-rw-r--r-- | gdb/valops.c | 15 | ||||
-rw-r--r-- | gdb/value.c | 19 | ||||
-rw-r--r-- | gdb/value.h | 14 |
7 files changed, 26 insertions, 36 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 91ee226..dc8a2f9 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -785,7 +785,7 @@ read_frame_register_value (value *value) gdbarch *gdbarch = frame_unwind_arch (next_frame); LONGEST offset = 0; LONGEST reg_offset = value->offset (); - int regnum = VALUE_REGNUM (value); + int regnum = value->regnum (); int len = type_length_units (check_typedef (value->type ())); /* Skip registers wholly inside of REG_OFFSET. */ diff --git a/gdb/frame.c b/gdb/frame.c index 5f4c8c6..41003cc 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1196,7 +1196,7 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum, *lvalp = value->lval (); *addrp = value->address (); if (*lvalp == lval_register) - *realnump = VALUE_REGNUM (value); + *realnump = value->regnum (); else *realnump = -1; @@ -1304,8 +1304,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum) else { if (value->lval () == lval_register) - gdb_printf (&debug_file, " register=%d", - VALUE_REGNUM (value)); + gdb_printf (&debug_file, " register=%d", value->regnum ()); else if (value->lval () == lval_memory) gdb_printf (&debug_file, " address=%s", paddress (gdbarch, @@ -1417,7 +1416,7 @@ read_frame_register_unsigned (frame_info_ptr frame, int regnum, { struct gdbarch *gdbarch = get_frame_arch (frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int size = register_size (gdbarch, VALUE_REGNUM (regval)); + int size = register_size (gdbarch, regval->regnum ()); *val = extract_unsigned_integer (regval->contents ().data (), size, byte_order); diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 8fed55b..f12485c 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -336,7 +336,7 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args, PyObject *kw) struct value *user_reg_value = value_of_user_reg (regnum, pending_frame->frame_info); if (user_reg_value->lval () == lval_register) - regnum = VALUE_REGNUM (user_reg_value); + regnum = user_reg_value->regnum (); if (regnum >= gdbarch_num_cooked_regs (pending_frame->gdbarch)) { PyErr_SetString (PyExc_ValueError, "Bad register"); diff --git a/gdb/stack.c b/gdb/stack.c index 20bb85e..fad4b62 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1724,8 +1724,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) else if (value->lval () == lval_register) { gdb_printf (" Previous frame's sp in %s\n", - gdbarch_register_name (gdbarch, - VALUE_REGNUM (value))); + gdbarch_register_name (gdbarch, value->regnum ())); } release_value (value); diff --git a/gdb/valops.c b/gdb/valops.c index 5a5b3f1..16cdf1f 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1194,8 +1194,7 @@ value_assign (struct value *toval, struct value *fromval) case lval_register: { frame_info_ptr next_frame = frame_find_by_id (toval->next_frame_id ()); - - int value_reg = VALUE_REGNUM (toval); + int value_reg = toval->regnum (); if (next_frame == nullptr) error (_("Value being assigned to is no longer active.")); @@ -1240,15 +1239,13 @@ value_assign (struct value *toval, struct value *fromval) } else { - if (gdbarch_convert_register_p (gdbarch, VALUE_REGNUM (toval), - type)) + if (gdbarch_convert_register_p (gdbarch, toval->regnum (), type)) { /* If TOVAL is a special machine register requiring conversion of program values to a special raw format. */ - gdbarch_value_to_register (gdbarch, - get_prev_frame_always (next_frame), - VALUE_REGNUM (toval), type, + gdbarch_value_to_register (gdbarch, next_frame, + toval->regnum (), type, fromval->contents ().data ()); } else @@ -1415,8 +1412,8 @@ address_of_variable (struct symbol *var, const struct block *b) frame_info_ptr frame = frame_find_by_id (val->next_frame_id ()); gdb_assert (frame != nullptr); - regname = gdbarch_register_name (get_frame_arch (frame), - VALUE_REGNUM (val)); + regname + = gdbarch_register_name (get_frame_arch (frame), val->regnum ()); gdb_assert (regname != nullptr && *regname != '\0'); error (_("Address requested for identifier " diff --git a/gdb/value.c b/gdb/value.c index 87eb6ef..086f8c9 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -971,7 +971,7 @@ value::allocate_register_lazy (frame_info_ptr next_frame, int regnum, value *result = value::allocate_lazy (type); result->set_lval (lval_register); - VALUE_REGNUM (result) = regnum; + result->m_location.reg.regnum = regnum; result->m_location.reg.next_frame_id = get_frame_id (next_frame); return result; @@ -1421,14 +1421,6 @@ value::set_address (CORE_ADDR addr) m_location.address = addr; } -int * -value::deprecated_regnum_hack () -{ - gdb_assert (m_lval == lval_register); - return &m_location.reg.regnum; -} - - /* Return a mark in the value chain. All values allocated after the mark is obtained (except for those released) are subject to being freed if a subsequent value_free_to_mark is passed the mark. */ @@ -3921,8 +3913,6 @@ value::fetch_lazy_memory () void value::fetch_lazy_register () { - - int regnum; struct type *type = check_typedef (this->type ()); struct value *new_val = this; @@ -3938,7 +3928,7 @@ value::fetch_lazy_register () frame_info_ptr next_frame = frame_find_by_id (next_frame_id); gdb_assert (next_frame != NULL); - regnum = VALUE_REGNUM (new_val); + int regnum = new_val->regnum (); /* Convertible register routines are used for multi-register values and for interpretation in different types @@ -3982,7 +3972,7 @@ value::fetch_lazy_register () { frame_info_ptr frame = frame_find_by_id (this->next_frame_id ()); frame = get_prev_frame_always (frame); - regnum = VALUE_REGNUM (this); + int regnum = this->regnum (); gdbarch *gdbarch = get_frame_arch (frame); string_file debug_file; @@ -4003,8 +3993,7 @@ value::fetch_lazy_register () gdb::array_view<const gdb_byte> buf = new_val->contents (); if (new_val->lval () == lval_register) - gdb_printf (&debug_file, " register=%d", - VALUE_REGNUM (new_val)); + gdb_printf (&debug_file, " register=%d", new_val->regnum ()); else if (new_val->lval () == lval_memory) gdb_printf (&debug_file, " address=%s", paddress (gdbarch, diff --git a/gdb/value.h b/gdb/value.h index 0e8c759..9fd8732 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -383,7 +383,16 @@ public: return m_location.reg.next_frame_id; } - int *deprecated_regnum_hack (); + /* Return this value's register number. + + The value must be of lval == lval_register. */ + int regnum () + { + gdb_assert (m_lval == lval_register); + + return m_location.reg.regnum; + } + /* contents() and contents_raw() both return the address of the gdb buffer used to hold a copy of the contents of the lval. @@ -972,9 +981,6 @@ extern void error_value_optimized_out (void); /* Pointer to internal variable. */ #define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ())) -/* Register number if the value is from a register. */ -#define VALUE_REGNUM(val) (*((val)->deprecated_regnum_hack ())) - /* Return value after lval_funcs->coerce_ref (after check_typedef). Return NULL if lval_funcs->coerce_ref is not applicable for whatever reason. */ |