Re: [patch/rfc] Separate gdbarch_data_register_pre_init

Andrew Cagney
2004-03-08T23:51:01Z

> Date: Mon, 08 Mar 2004 14:28:00 -0500
> From: Andrew Cagney <cagney@gnu.org>
>
> The dwarf2-frame code is then modified to use the first mechanism. I've
> left the other clients alone (but did deprecate set_gdbarch_data as that
> should now be redundant).
>
> I'm not so sure that set_gdbarch_data is now redundant. I can imagine
> that one would like to set a per-architecture data thingy to a
> different value after its initial initialization.

Hmm, only one assignment has ever been possible:

> set_gdbarch_data (struct gdbarch *gdbarch,
> struct gdbarch_data *data,
> void *pointer)
> {
> gdb_assert (data->index < gdbarch->nr_data);
> gdb_assert (gdbarch->data[data->index] == NULL);
> gdbarch->data[data->index] = pointer;
> }

and being able to do otherwize wasn't the intent. Instead of trying to
modify the data thingie, code should modify the contents pointed to by
the thingie. For instance, in dwarf2-frame:

struct dwarf2_frame_ops
{
/* Pre-initialize the register state REG for register REGNUM. */
void (*init_reg) (struct gdbarch *, int, struct
dwarf2_frame_state_reg *);
};

the code can perform multiple assignments to "init_reg".

> So I'd rather you
> wouldn't deprecate the interface.
>
> Also note the name changes (better suggestions?).
>
> The names look fine to me.

Andrew