From: Zoran Zaric <zoran.zaric@amd.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH v3 10/17] Inline get_reg_value method of dwarf_expr_context
Date: Fri, 28 May 2021 16:46:41 +0100 [thread overview]
Message-ID: <20210528154648.60881-11-zoran.zaric@amd.com> (raw)
In-Reply-To: <20210528154648.60881-1-zoran.zaric@amd.com>
From: Zoran Zaric <Zoran.Zaric@amd.com>
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.
---
gdb/dwarf2/expr.c | 24 +++++++-----------------
gdb/dwarf2/expr.h | 6 ------
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 303b2b5ba14..1a068741894 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -176,19 +176,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)
@@ -1544,14 +1531,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;
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h
index 72cf14abcfc..aa80d1f31cb 100644
--- a/gdb/dwarf2/expr.h
+++ b/gdb/dwarf2/expr.h
@@ -211,12 +211,6 @@ struct dwarf_expr_context
void execute_stack_op (const gdb_byte *op_ptr, const gdb_byte *op_end);
void pop ();
- /* Return a value of type TYPE, stored in register number REGNUM
- in a current context.
-
- REGNUM is a DWARF register number. */
- struct value *get_reg_value (struct type *type, int regnum);
-
/* Return the location expression for the frame base attribute, in
START and LENGTH. The result must be live until the current
expression evaluation is complete. */
--
2.17.1
next prev parent reply other threads:[~2021-05-28 15:47 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-28 15:46 [PATCH v3 00/17] DWARF expression evaluator design cleanup Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 01/17] Replace the symbol needs evaluator with a parser Zoran Zaric
2021-06-07 21:48 ` Simon Marchi
2021-06-11 17:22 ` Zaric, Zoran (Zare)
2021-05-28 15:46 ` [PATCH v3 02/17] Cleanup of the dwarf_expr_context constructor Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 03/17] Move frame context info to dwarf_expr_context Zoran Zaric
2021-06-09 0:45 ` Simon Marchi
2021-06-11 17:16 ` Zaric, Zoran (Zare)
2021-05-28 15:46 ` [PATCH v3 04/17] Remove get_frame_cfa from dwarf_expr_context Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 05/17] Move compilation unit info to dwarf_expr_context Zoran Zaric
2021-06-09 0:50 ` Simon Marchi
2021-06-11 17:19 ` Zaric, Zoran (Zare)
2021-05-28 15:46 ` [PATCH v3 06/17] Move dwarf_call " Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 07/17] Move get_object_address " Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 08/17] Move read_mem " Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 09/17] Move push_dwarf_reg_entry_value to expr.c Zoran Zaric
2021-05-28 15:46 ` Zoran Zaric [this message]
2021-05-28 15:46 ` [PATCH v3 11/17] Remove empty frame and full evaluators Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 12/17] Merge evaluate_for_locexpr_baton evaluator Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 13/17] Move piece_closure and its support to expr.c Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 14/17] Make value_copy also copy the stack data member Zoran Zaric
2021-05-28 15:46 ` [PATCH v3 15/17] Make DWARF evaluator return a single struct value Zoran Zaric
2021-08-11 17:00 ` Tom Tromey
2021-08-12 18:03 ` Tom Tromey
2021-08-13 9:57 ` Zoran Zaric
2021-08-13 16:59 ` Tom Tromey
2021-08-13 17:57 ` Zoran Zaric
2021-08-16 15:37 ` Tom Tromey
2021-08-16 16:05 ` Zoran Zaric
2021-08-16 17:32 ` Tom Tromey
2021-05-28 15:46 ` [PATCH v3 16/17] Simplify dwarf_expr_context class interface Zoran Zaric
2021-06-09 1:01 ` Simon Marchi
2021-06-11 17:20 ` Zaric, Zoran (Zare)
2021-05-28 15:46 ` [PATCH v3 17/17] Add as_lval argument to expression evaluator Zoran Zaric
2021-06-09 1:04 ` [PATCH v3 00/17] DWARF expression evaluator design cleanup Simon Marchi
2021-08-05 16:38 ` Zaric, Zoran (Zare)
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=20210528154648.60881-11-zoran.zaric@amd.com \
--to=zoran.zaric@amd.com \
--cc=gdb-patches@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: link
Be 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).