public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: structure offset to structure name conversion.
       [not found] ` <mcrr51y2ppv.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
@ 2011-10-27 19:42   ` Hagen Paul Pfeifer
  0 siblings, 0 replies; only message in thread
From: Hagen Paul Pfeifer @ 2011-10-27 19:42 UTC (permalink / raw)
  To: gcc-help

* Ian Lance Taylor | 2011-10-27 12:34:36 [-0700]:

>James Courtier-Dutton <james.dutton@gmail.com> writes:
>
>> If I have a structure e.g.
>> struct test_s {
>>     int32_t var1;
>>     int32_t var2;
>>     uint64_t var3;
>>     int var4;
>> } test;
>I'm not aware of anything quite like that, no.  I think the closest you
>could get easily would be to examine the debugging information.  E.g.,
>you could compile with -gstabs and run objdump -g.  You would still have
>to parse the objdump -g output, but at least the offset is there.

Or pahole (which also parse DWARF information):

pahole foo.c test_s

struct test_s {
		int32_t var1;    /*   0     4 */
		int32_t var2;    /*   4     4 */
		uint64_t var3;   /*   8     4 */
		int var4;        /*  16     4 */
};


Hagen

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-27 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAAMvbhEFoBxrgAZi4oyv7EryuiD8oQySXUjxffdvixMKHV5xxg@mail.gmail.com>
     [not found] ` <mcrr51y2ppv.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
2011-10-27 19:42   ` structure offset to structure name conversion Hagen Paul Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).