aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
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/dwarf2loc.c
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/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index c314a78..3a81202 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -265,14 +265,17 @@ read_pieced_value (struct value *v)
struct gdbarch *arch = get_frame_arch (frame);
bfd_byte regval[MAX_REGISTER_SIZE];
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch,
- p->v.value);
+ p->v.expr.value);
get_frame_register (frame, gdb_regnum, regval);
memcpy (contents + offset, regval, p->size);
}
break;
case DWARF_VALUE_MEMORY:
- read_memory (p->v.value, contents + offset, p->size);
+ if (p->v.expr.in_stack_memory)
+ read_stack (p->v.expr.value, contents + offset, p->size);
+ else
+ read_memory (p->v.expr.value, contents + offset, p->size);
break;
case DWARF_VALUE_STACK:
@@ -282,7 +285,7 @@ read_pieced_value (struct value *v)
int addr_size = gdbarch_addr_bit (c->arch) / 8;
store_unsigned_integer (bytes, addr_size,
gdbarch_byte_order (c->arch),
- p->v.value);
+ p->v.expr.value);
n = p->size;
if (n > addr_size)
n = addr_size;
@@ -330,12 +333,12 @@ write_pieced_value (struct value *to, struct value *from)
case DWARF_VALUE_REGISTER:
{
struct gdbarch *arch = get_frame_arch (frame);
- int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.value);
+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.expr.value);
put_frame_register (frame, gdb_regnum, contents + offset);
}
break;
case DWARF_VALUE_MEMORY:
- write_memory (p->v.value, contents + offset, p->size);
+ write_memory (p->v.expr.value, contents + offset, p->size);
break;
default:
set_value_optimized_out (to, 1);
@@ -434,11 +437,13 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
case DWARF_VALUE_MEMORY:
{
CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
+ int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
retval = allocate_value (SYMBOL_TYPE (var));
VALUE_LVAL (retval) = lval_memory;
set_value_lazy (retval, 1);
- set_value_stack (retval, 1);
+ if (in_stack_memory)
+ set_value_stack (retval, 1);
set_value_address (retval, address);
}
break;
@@ -485,10 +490,6 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
return retval;
}
-
-
-
-
/* Helper functions and baton for dwarf2_loc_desc_needs_frame. */