forked from Imagelibrary/binutils-gdb
* dwarf2expr.h (dwarf_value_location): Add more comments describing
enum values. (struct dwarf_stack_value): New struct. (struct dwarf_expr_context): Change type of `stack' from CORE_ADDR* to struct dwarf_stack_value*. (struct dwarf_expr_piece): Move `v.value' into its own struct, v.expr, all uses updated. Add v.expr.in_stack_memory. (dwarf_expr_push): Update declaration. (dwarf_expr_fetch_in_stack_memory): Declare. * dwarf2expr.c (dwarf_expr_grow_stack): Update calculation of size of stack value. (dwarf_expr_push): New arg in_stack_memory, all callers updated. (dwarf_expr_fetch_in_stack_memory): New function. (add_piece): Set in_stack_memory for non-literal values. (execute_stack_op): Allow ops to specify whether the value is on the program's stack. (execute_stack_op, case DW_OP_fbreg): Mark value as in stack memory. (execute_stack_op, case DW_OP_call_frame_cfa): Ditto. (execute_stack_op, case DW_OP_dup): Copy in_stack_memory flag. (execute_stack_op, cases DW_OP_pick, DW_OP_over): Ditto. (execute_stack_op, cases DW_OP_swap, DW_OP_rot): Update type of dwarf stack value. * dwarf2loc.c (read_pieced_value): Call read_stack for values known to be on the program's stack. (dwarf2_evaluate_loc_desc, case DWARF_VALUE_MEMORY): Call set_value_stack only for objects known to be in stack memory. * dwarf2-frame.c (execute_stack_op): New arg initial_in_stack_memory, all callers updated.
This commit is contained in:
@@ -26,22 +26,41 @@
|
||||
/* The location of a value. */
|
||||
enum dwarf_value_location
|
||||
{
|
||||
/* The piece is in memory. */
|
||||
/* The piece is in memory.
|
||||
The value on the dwarf stack is its address. */
|
||||
DWARF_VALUE_MEMORY,
|
||||
/* The piece is in a register. */
|
||||
|
||||
/* The piece is in a register.
|
||||
The value on the dwarf stack is the register number. */
|
||||
DWARF_VALUE_REGISTER,
|
||||
/* The piece is on the stack. */
|
||||
|
||||
/* The piece is on the dwarf stack. */
|
||||
DWARF_VALUE_STACK,
|
||||
|
||||
/* The piece is a literal. */
|
||||
DWARF_VALUE_LITERAL
|
||||
};
|
||||
|
||||
/* The dwarf expression stack. */
|
||||
|
||||
struct dwarf_stack_value
|
||||
{
|
||||
CORE_ADDR value;
|
||||
|
||||
/* Non-zero if the piece is in memory and is known to be
|
||||
on the program's stack. It is always ok to set this to zero.
|
||||
This is used, for example, to optimize memory access from the target.
|
||||
It can vastly speed up backtraces on long latency connections when
|
||||
"set stack-cache on". */
|
||||
int in_stack_memory;
|
||||
};
|
||||
|
||||
/* The expression evaluator works with a dwarf_expr_context, describing
|
||||
its current state and its callbacks. */
|
||||
struct dwarf_expr_context
|
||||
{
|
||||
/* The stack of values, allocated with xmalloc. */
|
||||
CORE_ADDR *stack;
|
||||
struct dwarf_stack_value *stack;
|
||||
|
||||
/* The number of values currently pushed on the stack, and the
|
||||
number of elements allocated to the stack. */
|
||||
@@ -111,7 +130,7 @@ struct dwarf_expr_context
|
||||
Each time DW_OP_piece is executed, we add a new element to the
|
||||
end of this array, recording the current top of the stack, the
|
||||
current location, and the size given as the operand to
|
||||
DW_OP_piece. We then pop the top value from the stack, rest the
|
||||
DW_OP_piece. We then pop the top value from the stack, reset the
|
||||
location, and resume evaluation.
|
||||
|
||||
The Dwarf spec doesn't say whether DW_OP_piece pops the top value
|
||||
@@ -140,8 +159,14 @@ struct dwarf_expr_piece
|
||||
|
||||
union
|
||||
{
|
||||
/* This piece's address or register number. */
|
||||
CORE_ADDR value;
|
||||
struct
|
||||
{
|
||||
/* This piece's address or register number. */
|
||||
CORE_ADDR value;
|
||||
/* Non-zero if the piece is known to be in memory and on
|
||||
the program's stack. */
|
||||
int in_stack_memory;
|
||||
} expr;
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -162,11 +187,13 @@ void free_dwarf_expr_context (struct dwarf_expr_context *ctx);
|
||||
struct cleanup *
|
||||
make_cleanup_free_dwarf_expr_context (struct dwarf_expr_context *ctx);
|
||||
|
||||
void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value);
|
||||
void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value,
|
||||
int in_stack_memory);
|
||||
void dwarf_expr_pop (struct dwarf_expr_context *ctx);
|
||||
void dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
|
||||
size_t len);
|
||||
CORE_ADDR dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n);
|
||||
int dwarf_expr_fetch_in_stack_memory (struct dwarf_expr_context *ctx, int n);
|
||||
|
||||
|
||||
gdb_byte *read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r);
|
||||
|
||||
Reference in New Issue
Block a user