diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2010-06-25 13:00:33 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2010-06-25 13:00:33 +0000 |
commit | f2c7657e9a0e18772ce4b0a95afd2b6546152b78 (patch) | |
tree | a7af9795f2e7daa59d8e72d016040c1a294b7aee /gdb/dwarf2loc.c | |
parent | b1d61bc9d188010bf897f8155a76fb76ab99775f (diff) | |
download | gdb-f2c7657e9a0e18772ce4b0a95afd2b6546152b78.zip gdb-f2c7657e9a0e18772ce4b0a95afd2b6546152b78.tar.gz gdb-f2c7657e9a0e18772ce4b0a95afd2b6546152b78.tar.bz2 |
ChangeLog:
* dwarf2expr.h (struct dwarf_value_location): Use ULONGEST as type
of stack values.
(struct dwarf_expr_piece): Rename "expr" member to "mem". Add new
"value" member.
(dwarf_expr_push): Change input type to ULONGEST.
(dwarf_expr_fetch): Change return type to ULONGEST.
(dwarf_expr_fetch_address): Add prototype.
(dwarf2_read_address): Remove prototype.
* dwarf2expr.c (dwarf_expr_push): Use ULONGEST as type of stack values.
Truncate stack values to ctx->addr_size bytes.
(dwarf_expr_fetch): Change return value to ULONGEST.
(dwarf_expr_fetch_address): New function.
(add_piece): Use dwarf_expr_fetch_address instead of dwarf_expr_fetch
when appropriate. Update for struct dwarf_expr_piece changes.
(dwarf2_read_address): Remove.
(unsigned_address_type): Remove.
(signed_address_type): Remove.
(execute_stack_op): Use dwarf_expr_fetch_address instead of
dwarf_expr_fetch when appropriate. Use ULONGEST as type of stack
values. Perform operations on ULONGEST instead of on GDB values,
sign-extending from ctx->addr_size bytes as needed. Read DW_OP_addr
values and DW_OP_deref results as unsigned integers.
* dwarf2loc.c (read_pieced_value): Update for struct dwarf_expr_piece
changes.
(write_pieced_value): Likewise.
(dwarf2_evaluate_loc_desc): Use dwarf_expr_fetch_address instead of
dwarf_expr_fetch when appropriate.
(compile_dwarf_to_ax): Read DW_OP_addr values as unsigned integers.
* dwarf2-frame.c (execute_stack_op): Use dwarf_expr_fetch_address
instead of dwarf_expr_fetch when appropriate.
testsuite/ChangeLog:
* gdb.cell/dwarfaddr.exp: New file.
* gdb.cell/dwarfaddr.S: New file.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r-- | gdb/dwarf2loc.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 46007c2..1965022 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -548,8 +548,7 @@ read_pieced_value (struct value *v) case DWARF_VALUE_REGISTER: { struct gdbarch *arch = get_frame_arch (frame); - int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, - p->v.expr.value); + int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.value); int reg_offset = source_offset; if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG @@ -570,16 +569,16 @@ read_pieced_value (struct value *v) else { error (_("Unable to access DWARF register number %s"), - paddress (arch, p->v.expr.value)); + paddress (arch, p->v.value)); } } break; case DWARF_VALUE_MEMORY: - if (p->v.expr.in_stack_memory) - read_stack (p->v.expr.value + source_offset, buffer, this_size); + if (p->v.mem.in_stack_memory) + read_stack (p->v.mem.addr + source_offset, buffer, this_size); else - read_memory (p->v.expr.value + source_offset, buffer, this_size); + read_memory (p->v.mem.addr + source_offset, buffer, this_size); break; case DWARF_VALUE_STACK: @@ -598,14 +597,14 @@ read_pieced_value (struct value *v) else if (source_offset == 0) store_unsigned_integer (buffer, n, gdbarch_byte_order (gdbarch), - p->v.expr.value); + p->v.value); else { gdb_byte bytes[sizeof (ULONGEST)]; store_unsigned_integer (bytes, n + source_offset, gdbarch_byte_order (gdbarch), - p->v.expr.value); + p->v.value); memcpy (buffer, bytes + source_offset, n); } } @@ -730,7 +729,7 @@ 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.expr.value); + int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.value); int reg_offset = dest_offset; if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG @@ -756,7 +755,7 @@ write_pieced_value (struct value *to, struct value *from) else { error (_("Unable to write to DWARF register number %s"), - paddress (arch, p->v.expr.value)); + paddress (arch, p->v.value)); } } break; @@ -765,8 +764,8 @@ write_pieced_value (struct value *to, struct value *from) { /* Only the first and last bytes can possibly have any bits reused. */ - read_memory (p->v.expr.value + dest_offset, buffer, 1); - read_memory (p->v.expr.value + dest_offset + this_size - 1, + read_memory (p->v.mem.addr + dest_offset, buffer, 1); + read_memory (p->v.mem.addr + dest_offset + this_size - 1, buffer + this_size - 1, 1); copy_bitwise (buffer, dest_offset_bits, contents, source_offset_bits, @@ -774,7 +773,7 @@ write_pieced_value (struct value *to, struct value *from) bits_big_endian); } - write_memory (p->v.expr.value + dest_offset, + write_memory (p->v.mem.addr + dest_offset, source_buffer, this_size); break; default: @@ -935,7 +934,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, case DWARF_VALUE_REGISTER: { struct gdbarch *arch = get_frame_arch (frame); - CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0); + ULONGEST dwarf_regnum = dwarf_expr_fetch (ctx, 0); int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum); if (gdb_regnum != -1) @@ -948,7 +947,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, case DWARF_VALUE_MEMORY: { - CORE_ADDR address = dwarf_expr_fetch (ctx, 0); + CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0); int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); retval = allocate_value (type); @@ -962,7 +961,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, case DWARF_VALUE_STACK: { - ULONGEST value = (ULONGEST) dwarf_expr_fetch (ctx, 0); + ULONGEST value = dwarf_expr_fetch (ctx, 0); bfd_byte *contents; size_t n = ctx->addr_size; @@ -1233,7 +1232,6 @@ compile_dwarf_to_ax (struct agent_expr *expr, struct axs_value *loc, while (op_ptr < op_end) { enum dwarf_location_atom op = *op_ptr; - CORE_ADDR result; ULONGEST uoffset, reg; LONGEST offset; int i; @@ -1295,8 +1293,8 @@ compile_dwarf_to_ax (struct agent_expr *expr, struct axs_value *loc, break; case DW_OP_addr: - result = dwarf2_read_address (arch, op_ptr, op_end, addr_size); - ax_const_l (expr, result); + ax_const_l (expr, extract_unsigned_integer (op_ptr, + addr_size, byte_order)); op_ptr += addr_size; break; |