diff options
author | Zoran Zaric <Zoran.Zaric@amd.com> | 2020-09-22 10:44:45 +0100 |
---|---|---|
committer | Zoran Zaric <zoran.zaric@amd.com> | 2021-08-05 16:41:05 +0100 |
commit | 70454ee70ad63c77d39768f057d722214adef658 (patch) | |
tree | a299c5b3c18f61a9ec4a98b52e314ad006bb10eb /gdb/dwarf2/expr.h | |
parent | 0579205aec4369375dccb8566ba37eefee2be912 (diff) | |
download | binutils-70454ee70ad63c77d39768f057d722214adef658.zip binutils-70454ee70ad63c77d39768f057d722214adef658.tar.gz binutils-70454ee70ad63c77d39768f057d722214adef658.tar.bz2 |
Add as_lval argument to expression evaluator
There are cases where the result of the expression evaluation is
expected to be in a form of a value and not location description.
One place that has this requirement is dwarf_entry_parameter_to_value
function, but more are expected in the future. Until now, this
requirement was fulfilled by extending the evaluated expression with
a DW_OP_stack_value operation at the end.
New implementation, introduces a new evaluation argument instead.
* dwarf2/expr.c (dwarf_expr_context::fetch_result): Add as_lval
argument.
(dwarf_expr_context::eval_exp): Add as_lval argument.
* dwarf2/expr.h (struct dwarf_expr_context): Add as_lval
argument to fetch_result and eval_exp methods.
* dwarf2/frame.c (execute_stack_op): Add as_lval argument.
* dwarf2/loc.c (dwarf_entry_parameter_to_value): Remove
DWARF expression extension.
(dwarf2_evaluate_loc_desc_full): Add as_lval argument support.
(dwarf2_evaluate_loc_desc): Add as_lval argument support.
(dwarf2_locexpr_baton_eval): Add as_lval argument support.
Diffstat (limited to 'gdb/dwarf2/expr.h')
-rw-r--r-- | gdb/dwarf2/expr.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index a10fbac..16c5e71 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -126,11 +126,17 @@ struct dwarf_expr_context void push_address (CORE_ADDR value, bool in_stack_memory); /* Evaluate the expression at ADDR (LEN bytes long) in a given PER_CU - and FRAME context. TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET describe - the expected struct value representation of the evaluation - result. The ADDR_INFO property can be specified to override the - range of memory addresses with the passed in buffer. */ - value *evaluate (const gdb_byte *addr, size_t len, + and FRAME context. + + AS_LVAL defines if the returned struct value is expected to be a + value (false) or a location description (true). + + TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET describe the expected struct + value representation of the evaluation result. + + The ADDR_INFO property can be specified to override the range of + memory addresses with the passed in buffer. */ + value *evaluate (const gdb_byte *addr, size_t len, bool as_lval, dwarf2_per_cu_data *per_cu, frame_info *frame, const struct property_addr_info *addr_info = nullptr, struct type *type = nullptr, @@ -211,9 +217,11 @@ private: /* Fetch the result of the expression evaluation in a form of a struct value, where TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET - describe the source level representation of that result. */ + describe the source level representation of that result. + AS_LVAL defines if the fetched struct value is expected to + be a value or a location description. */ value *fetch_result (struct type *type, struct type *subobj_type, - LONGEST subobj_offset); + LONGEST subobj_offset, bool as_lval); /* Return the location expression for the frame base attribute, in START and LENGTH. The result must be live until the current |