aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/expr.h
diff options
context:
space:
mode:
authorZoran Zaric <zoran.zaric@amd.com>2020-09-15 16:52:11 +0100
committerZoran Zaric <zoran.zaric@amd.com>2021-08-05 16:40:47 +0100
commitba5bc3e5a9268bcdc701d5a6701a9b41538a3f51 (patch)
treed90bed1f7780e64faf9fe4e92cc7060ab8533745 /gdb/dwarf2/expr.h
parentefa86d3c26457c4c619fddef8232738d5091978b (diff)
downloadgdb-ba5bc3e5a9268bcdc701d5a6701a9b41538a3f51.zip
gdb-ba5bc3e5a9268bcdc701d5a6701a9b41538a3f51.tar.gz
gdb-ba5bc3e5a9268bcdc701d5a6701a9b41538a3f51.tar.bz2
Make DWARF evaluator return a single struct value
The patch is addressing the issue of class users writing and reading the internal data of the dwarf_expr_context class. At this point, all conditions are met for the DWARF evaluator to return an evaluation result in a form of a single struct value object. gdb/ChangeLog: * dwarf2/expr.c (pieced_value_funcs): Chenge to static function. (allocate_piece_closure): Change to static function. (dwarf_expr_context::fetch_result): New function. * dwarf2/expr.h (struct piece_closure): Remove declaration. (struct dwarf_expr_context): fetch_result new declaration. fetch, fetch_address and fetch_in_stack_memory members move to private. (allocate_piece_closure): Remove. * dwarf2/frame.c (execute_stack_op): Change to use fetch_result. * dwarf2/loc.c (dwarf2_evaluate_loc_desc_full): Change to use fetch_result. (dwarf2_locexpr_baton_eval): Change to use fetch_result. * dwarf2/loc.h (invalid_synthetic_pointer): Expose function.
Diffstat (limited to 'gdb/dwarf2/expr.h')
-rw-r--r--gdb/dwarf2/expr.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h
index c9ba2a6..4b94951 100644
--- a/gdb/dwarf2/expr.h
+++ b/gdb/dwarf2/expr.h
@@ -26,7 +26,6 @@
#include "gdbtypes.h"
struct dwarf2_per_objfile;
-struct piece_closure;
/* The location of a value. */
enum dwarf_value_location
@@ -125,9 +124,13 @@ struct dwarf_expr_context
void push_address (CORE_ADDR value, bool in_stack_memory);
void eval (const gdb_byte *addr, size_t len);
- struct value *fetch (int n);
- CORE_ADDR fetch_address (int n);
- bool fetch_in_stack_memory (int n);
+
+ /* 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. */
+ value *fetch_result (struct type *type = nullptr,
+ struct type *subobj_type = nullptr,
+ LONGEST subobj_offset = 0);
/* The stack of values. */
std::vector<dwarf_stack_value> stack;
@@ -203,6 +206,9 @@ private:
void add_piece (ULONGEST size, ULONGEST offset);
void execute_stack_op (const gdb_byte *op_ptr, const gdb_byte *op_end);
void pop ();
+ struct value *fetch (int n);
+ CORE_ADDR fetch_address (int n);
+ bool fetch_in_stack_memory (int n);
/* Return the location expression for the frame base attribute, in
START and LENGTH. The result must be live until the current
@@ -301,13 +307,4 @@ extern const gdb_byte *safe_read_sleb128 (const gdb_byte *buf,
extern const gdb_byte *safe_skip_leb128 (const gdb_byte *buf,
const gdb_byte *buf_end);
-extern const struct lval_funcs pieced_value_funcs;
-
-/* Allocate a closure for a value formed from separately-described
- PIECES. */
-
-piece_closure *allocate_piece_closure
- (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
- std::vector<dwarf_expr_piece> &&pieces, frame_info *frame);
-
#endif /* dwarf2expr.h */