This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: structure offset to structure name conversion.


* 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


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