This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH/RFC] Per-architecture DWARF CFI register state initializationhooks
Sorry, my analysis wasn't completely correct. What actually happens
is an init-order problem during the initialization of the gdbarch
in initialize_current_architecture. The problem is that I call
dwarf2_frame_set_init_reg from within the s390_gdbarch_init routine
(which I gather is the right place?), and at this point in time,
the gdbarch_data call in dwarf2_frame_set_init_reg returns NULL
because the gdbarch hasn't finished initialization yet:
I've committed the attatched. It follows the convention described in that revised doco patch I posted:
http://sources.redhat.com/ml/gdb-patches/2004-02/msg00381.html
Andrew
with patch ...
2004-02-16 Andrew Cagney <cagney@redhat.com>
* dwarf2-frame.c (dwarf2_frame_ops): New function.
(dwarf2_frame_set_init_reg): Use, instead of gdbarch_data.
(dwarf2_frame_init_reg): Ditto.
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.30
diff -u -r1.30 dwarf2-frame.c
--- dwarf2-frame.c 15 Feb 2004 21:29:26 -0000 1.30
+++ dwarf2-frame.c 16 Feb 2004 20:28:01 -0000
@@ -518,6 +518,20 @@
return ops;
}
+static struct dwarf2_frame_ops *
+dwarf2_frame_ops (struct gdbarch *gdbarch)
+{
+ struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ if (ops == NULL)
+ {
+ /* ULGH, called during architecture initialization. Patch
+ things up. */
+ ops = dwarf2_frame_init (gdbarch);
+ set_gdbarch_data (gdbarch, dwarf2_frame_data, ops);
+ }
+ return ops;
+}
+
/* Set the architecture-specific register state initialization
function for GDBARCH to INIT_REG. */
@@ -528,7 +542,7 @@
{
struct dwarf2_frame_ops *ops;
- ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ ops = dwarf2_frame_ops (gdbarch);
ops->init_reg = init_reg;
}
@@ -540,7 +554,7 @@
{
struct dwarf2_frame_ops *ops;
- ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ ops = dwarf2_frame_ops (gdbarch);
ops->init_reg (gdbarch, regnum, reg);
}