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 initialization hooks
- From: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- To: drow at false dot org (Daniel Jacobowitz)
- Cc: weigand at i1 dot informatik dot uni-erlangen dot de (Ulrich Weigand), kettenis at chello dot nl, gdb-patches at gcc dot gnu dot org, cagney at gnu dot org
- Date: Mon, 16 Feb 2004 14:01:29 +0100 (CET)
- Subject: Re: [PATCH/RFC] Per-architecture DWARF CFI register state initialization hooks
Daniel Jacobowitz wrote:
> On Mon, Feb 16, 2004 at 02:27:24AM +0100, Ulrich Weigand wrote:
> > +void
> > +dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
> > + void (*init_reg) (struct gdbarch *, int,
> > + struct dwarf2_frame_state_reg *))
>
> > Unfortunately this now crashes on s390, because the
> > dwarf2_frame_init routine is called from within
> > _initialize_dwarf2_frame, while the s390 backend calls
> > dwarf2_frame_set_init_reg from within _initialize_s390_tdep.
>
> Er, how? You shouldn't have a gdbarch in _initialize_s390_tdep. You
> don't have one until s390_gdbarch_init.
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:
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
{
gdb_assert (data->index < gdbarch->nr_data);
/* The data-pointer isn't initialized, call init() to get a value but
only if the architecture initializaiton has completed. Otherwise
punt - hope that the caller knows what they are doing. */
if (gdbarch->data[data->index] == NULL
&& gdbarch->initialized_p)
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de