aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2expr.h
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-09-15 16:20:53 +0000
committerDoug Evans <dje@google.com>2009-09-15 16:20:53 +0000
commit44353522ecb0bfbddc5670741e5e8a3f7ae8d2e6 (patch)
treec313a1ee9d6ba6f9709239eb7aaf324123f19a4d /gdb/dwarf2expr.h
parent7d4f32d36af917e1f2662f204146b808bbbbf8f2 (diff)
downloadgdb-44353522ecb0bfbddc5670741e5e8a3f7ae8d2e6.zip
gdb-44353522ecb0bfbddc5670741e5e8a3f7ae8d2e6.tar.gz
gdb-44353522ecb0bfbddc5670741e5e8a3f7ae8d2e6.tar.bz2
* 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.
Diffstat (limited to 'gdb/dwarf2expr.h')
-rw-r--r--gdb/dwarf2expr.h43
1 files changed, 35 insertions, 8 deletions
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index 9d9b127..a9a8a05 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -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);