RFA: unbreak typedefed bitfield

Tom Tromey tromey@redhat.com
Mon Dec 21 17:08:00 GMT 2009

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Volodya> It seems to me that TYPE_LENGTH may return different values before and
Volodya> after check_typedef is called. Is the 'before' value ever or any use?

I don't think so.  My understanding is that before check_typedef is
called, TYPE_LENGTH is not guaranteed to be valid.

Volodya> If no, and as you say above in some cases we need to preserve
Volodya> some properties of the typedef, why TYPE_LENGTH could not check
Volodya> if the type is typedef, and if so, return length of the true
Volodya> type?

check_typedef is misnamed and is also used to resolve opaque types.
Other than that, I don't know of a reason.

You could try:

#define TYPE_LENGTH(thistype) check_typedef (thistype)->length

While this is probably insufficient to fix the check_typedef problem in
general, it may help with the most common source of problems.


More information about the Gdb-patches mailing list