Re: structure offset to structure name conversion.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

>James Courtier-Dutton <james.dutton@xxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux