This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: structure offset to structure name conversion.
- From: Hagen Paul Pfeifer <hagen at jauu dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 27 Oct 2011 21:41:57 +0200
- Subject: Re: structure offset to structure name conversion.
- References: <CAAMvbhEFoBxrgAZi4oyv7EryuiD8oQySXUjxffdvixMKHV5xxg@mail.gmail.com> <mcrr51y2ppv.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
* 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