* dwarf2read.c (dwarf2_const_value) <DW_form_addr>: Create a

LOC_COMPUTED symbol.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Set new field.
	(dwarf2_loc_desc_needs_frame): Likewise.
	(compile_dwarf_to_ax) <DW_OP_addr>: Use offset.
	* dwarf2expr.h (struct dwarf_expr_context) <offset>: New field.
	* dwarf2expr.c (execute_stack_op) <DW_OP_addr>: Use offset.
	* dwarf2-frame.c (execute_stack_op): Set 'offset' field.  Add
	'offset' argument.
	(struct dwarf2_frame_cache) <text_offset>: New field.
	(dwarf2_frame_cache): Set new field.
	(dwarf2_frame_prev_register): Update.
	(dwarf2_frame_sniffer): Update.
	(dwarf2_frame_base_sniffer): Update.
	(dwarf2_frame_find_fde): Add 'out_offset' argument.
This commit is contained in:
Tom Tromey
2010-07-07 17:26:38 +00:00
parent 0cf6dd1543
commit ac56253dde
6 changed files with 96 additions and 26 deletions

View File

@@ -891,6 +891,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
struct cleanup *old_chain;
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
if (size == 0)
{
@@ -906,8 +907,9 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
ctx = new_dwarf_expr_context ();
old_chain = make_cleanup_free_dwarf_expr_context (ctx);
ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (per_cu));
ctx->gdbarch = get_objfile_arch (objfile);
ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
ctx->offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
ctx->baton = &baton;
ctx->read_reg = dwarf_expr_read_reg;
ctx->read_mem = dwarf_expr_read_mem;
@@ -1083,6 +1085,7 @@ dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size,
struct dwarf_expr_context *ctx;
int in_reg;
struct cleanup *old_chain;
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
baton.needs_frame = 0;
baton.per_cu = per_cu;
@@ -1090,8 +1093,9 @@ dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size,
ctx = new_dwarf_expr_context ();
old_chain = make_cleanup_free_dwarf_expr_context (ctx);
ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (per_cu));
ctx->gdbarch = get_objfile_arch (objfile);
ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
ctx->offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
ctx->baton = &baton;
ctx->read_reg = needs_frame_read_reg;
ctx->read_mem = needs_frame_read_mem;
@@ -1293,9 +1297,20 @@ compile_dwarf_to_ax (struct agent_expr *expr, struct axs_value *loc,
break;
case DW_OP_addr:
ax_const_l (expr, extract_unsigned_integer (op_ptr,
addr_size, byte_order));
uoffset = extract_unsigned_integer (op_ptr, addr_size, byte_order);
op_ptr += addr_size;
/* Some versions of GCC emit DW_OP_addr before
DW_OP_GNU_push_tls_address. In this case the value is an
index, not an address. We don't support things like
branching between the address and the TLS op. */
if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
{
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
uoffset += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
}
ax_const_l (expr, uoffset);
break;
case DW_OP_const1u: