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: [PATCH v2] Implement pahole-like 'ptype /o' option


On 12/11/17 8:25 PM, Simon Marchi wrote:
> On 2017-12-11 19:51, Pedro Alves wrote:
>>>> So from that angle, I see value in not printing the offsets
>>>> of union members.
>>>
>>> Since it's still not clear whether the offsets should be printed or 
>>> not
>>> in this case, and I am not a global maintainer, I adjusted the code to
>>> print them and will post the patch as a reply to the v4 e-mail.  This
>>> way you can decide which version is best.
>>
>> Fun, just when I agreed with not printing the offsets... :-P  :-)
> 
> Damn, sorry for starting you guys on that track!  I just wanted to know 
> if it was intentional or not, I am fine with either.

The only reason I would find the offset usable is to know the offset of
a structure member inside of a union.  E.g.:

struct foo {
     int x;
     union {
         struct {
             int y;
             int z;
         };
         int a;
     };
};

I think it is useful to know the offset of 'foo.z' within the overall
structure.

-- 
John Baldwin


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