diff options
author | Zoran Zaric <Zoran.Zaric@amd.com> | 2020-10-09 15:06:15 +0100 |
---|---|---|
committer | Zoran Zaric <zoran.zaric@amd.com> | 2021-08-05 16:40:12 +0100 |
commit | 9e739f693f142ac634d9d127bd9951d0c62593c1 (patch) | |
tree | 54e47af07c4fac514bb3d0a34be5787ac57baa25 /gdb/dwarf2/expr.c | |
parent | 0a2b69d04bbb0b5d69ae93da998b65d44fc7612b (diff) | |
download | gdb-9e739f693f142ac634d9d127bd9951d0c62593c1.zip gdb-9e739f693f142ac634d9d127bd9951d0c62593c1.tar.gz gdb-9e739f693f142ac634d9d127bd9951d0c62593c1.tar.bz2 |
Inline get_reg_value method of dwarf_expr_context
The get_reg_value method is a small function that is only called once,
so it can be inlined to simplify the dwarf_expr_context class.
gdb/ChangeLog:
* dwarf2/expr.c (dwarf_expr_context::get_reg_value): Remove
method.
(dwarf_expr_context::execute_stack_op): Inline get_reg_value
method.
* dwarf2/expr.h (dwarf_expr_context::get_reg_value): Remove
method.
Diffstat (limited to 'gdb/dwarf2/expr.c')
-rw-r--r-- | gdb/dwarf2/expr.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index a90ebf4..5224ed0 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -168,19 +168,6 @@ dwarf_expr_context::fetch (int n) /* See expr.h. */ -struct value * -dwarf_expr_context::get_reg_value (struct type *type, int reg) -{ - ensure_have_frame (this->frame, "DW_OP_regval_type"); - - struct gdbarch *gdbarch = get_frame_arch (this->frame); - int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg); - - return value_from_register (type, regnum, this->frame); -} - -/* See expr.h. */ - void dwarf_expr_context::get_frame_base (const gdb_byte **start, size_t * length) @@ -1536,14 +1523,17 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, case DW_OP_regval_type: case DW_OP_GNU_regval_type: { - struct type *type; - op_ptr = safe_read_uleb128 (op_ptr, op_end, ®); op_ptr = safe_read_uleb128 (op_ptr, op_end, &uoffset); cu_offset type_die_cu_off = (cu_offset) uoffset; - type = get_base_type (type_die_cu_off); - result_val = this->get_reg_value (type, reg); + ensure_have_frame (this->frame, "DW_OP_regval_type"); + + struct type *type = get_base_type (type_die_cu_off); + int regnum + = dwarf_reg_to_regnum_or_error (get_frame_arch (this->frame), + reg); + result_val = value_from_register (type, regnum, this->frame); } break; |