RFA: unbreak typedefed bitfield
Fri Dec 18 13:06:00 GMT 2009
> And here's a trivial patch to fix this problem. I would claim this
> clearly indicates a design bug in GDB type mechanism -- and it bites
> us repeatedly, but I'm not ready to propose a specific way to fix it,
I have noticed the same issue repeatedly in the Ada section of the code,
and it's been really annoying to bump into this. As a result, we've seen
an explosion of check_typedef (or the Ada equivalent ada_check_typedef),
and I also feel that something's not right. I have a general feeling
that most of the time, the typedef should have never been passed down.
But I haven't spent the time and effort to try to think globally.
I did have some thoughts for the Ada side, where things are a little
more codified (and where every type is also a typedef), but that
requires a revamp of the Ada code, which I'm leaving for later, when
most of AdaCore's code in the FSF tree.
In your case, we are being repeatdly bitten because we still manipulate
a raw struct gdb_type. If we have an opaque structure, it would
probably be easier to have a more general solution. Right now,
we access everything directly, so we have to be careful, depending
on the situation.
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -1873,6 +1873,7 @@ value_primitive_field (struct value *arg1, int offset,
> CHECK_TYPEDEF (arg_type);
> type = TYPE_FIELD_TYPE (arg_type, fieldno);
> + check_typedef (type);
> /* Handle packed fields */
Looks OK to me (you forgot the ChangeLog entry, btw).
More information about the Gdb-patches