This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: unbreak typedefed bitfield


> 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,
> yet.

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).

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]