This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[07/11] Fortran dynamic arrays support: DW_OP_push_object_address
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 16 Nov 2007 04:20:34 +0100
- Subject: [07/11] Fortran dynamic arrays support: DW_OP_push_object_address
Hi,
DWARF support for DW_OP_push_object_address.
Regards,
Jan
2007-11-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2expr.c (execute_stack_op): New support for
`DW_OP_push_object_address'.
* dwarf2expr.h (struct dwarf_expr_context): New (uncommented) field
GET_OBJECT_ADDRESS.
* dwarf2read.c (dwarf_block_object_address): New function.
(dwarf_block_exec_core): Fill in GET_OBJECT_ADDRESS.
Index: sources/gdb/dwarf2expr.c
===================================================================
--- sources.orig/gdb/dwarf2expr.c 2007-11-16 02:48:15.000000000 +0100
+++ sources/gdb/dwarf2expr.c 2007-11-16 02:48:48.000000000 +0100
@@ -747,6 +747,13 @@ execute_stack_op (struct dwarf_expr_cont
ctx->initialized = 0;
goto no_push;
+ case DW_OP_push_object_address:
+ if (ctx->get_object_address == NULL)
+ error (_("DWARF-2 expression error: DW_OP_push_object_address must "
+ "have a value to push."));
+ result = (ctx->get_object_address) (ctx->baton);
+ break;
+
default:
error (_("Unhandled dwarf expression opcode 0x%x"), op);
}
Index: sources/gdb/dwarf2expr.h
===================================================================
--- sources.orig/gdb/dwarf2expr.h 2007-11-16 02:48:47.000000000 +0100
+++ sources/gdb/dwarf2expr.h 2007-11-16 02:48:48.000000000 +0100
@@ -60,10 +60,10 @@ struct dwarf_expr_context
The result must be live until the current expression evaluation
is complete. */
unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length);
+#endif
/* Return the `object address' for DW_OP_push_object_address. */
CORE_ADDR (*get_object_address) (void *baton);
-#endif
/* The current depth of dwarf expression recursion, via DW_OP_call*,
DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
Index: sources/gdb/dwarf2read.c
===================================================================
--- sources.orig/gdb/dwarf2read.c 2007-11-16 02:48:47.000000000 +0100
+++ sources/gdb/dwarf2read.c 2007-11-16 02:51:03.000000000 +0100
@@ -4934,6 +4934,17 @@ dwarf_block_read_mem (void *baton, gdb_b
}
static CORE_ADDR
+dwarf_block_object_address (void *baton)
+{
+ struct dwarf_block_baton *debaton = baton;
+
+ if (debaton->address == 0)
+ error (_("Cannot resolve DW_OP_push_object_address for a missing object"));
+
+ return debaton->address;
+}
+
+static CORE_ADDR
dwarf_block_read_reg (void *baton, int regnum)
{
error (_("Unsupported operation for DW_FORM_block*: %s"), "read_reg");
@@ -4969,7 +4980,7 @@ static CORE_ADDR dwarf_block_exec_core (
back_to = make_cleanup ((make_cleanup_ftype *) free_dwarf_expr_context, ctx);
ctx->baton = &baton;
ctx->read_mem = dwarf_block_read_mem;
- /* ctx->get_object_address is missing here so far. */
+ ctx->get_object_address = dwarf_block_object_address;
ctx->read_reg = dwarf_block_read_reg;
ctx->get_frame_base = dwarf_block_get_frame_base;
ctx->get_tls_address = dwarf_block_get_tls_address;