[Ltrace-devel] Getting prototypes from debug information

Mark Wielaard mjw at redhat.com
Thu Apr 24 07:25:12 UTC 2014


On Thu, 2014-04-24 at 01:48 +0200, Petr Machata wrote:
> Dima Kogan <lists at dima.secretsauce.net> writes:
> >> I looked into this, and GCC currently doesn't seem to emit DW_AT_type
> >> for enums with specified base.  Instead it denotes signedness by
> >> encoding enumerators with DW_FORM_udata or DW_FORM_sdata.  Size of the
> >> underlying type is encoded in DW_TAG_enumeration_type's DW_AT_byte_size,
> >> which might be important for enums in structs (I don't think it will
> >> matter in naked parameters, unless in weird cases like __int128, which
> >> ltrace doesn't handle anyway).
> >
> > I ran some tests. Indeed, there's no DW_AT_type, but I always see
> > DW_FORM_sdata, even if it's supposedly unsigned. This is gcc 4.8.2. In
> > any case, the current code in my tree assumes signed. I think this is
> > fine for the first pass.
> 
> You're right, I'm not sure what I was looking at.  I don't see it as
> udata now either.

Maybe you were using a trunk GCC compiler? I just pushed a patch to make
GCC output enum const values a bit more efficient by using an unsigned
(DW_FORM_udata|data[1248]) form for positive constants:
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00754.html

A patch to add the DW_AT_type for the underlying enum type is pending:
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01283.html

Cheers,

Mark





More information about the Ltrace-devel mailing list