This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: structure offset to structure name conversion.
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;
>
> If I have an offset value of 8, I wish to do a lookup and get to:
> test.var3
>
> Is there some part of gcc that I could use to parse .h files and
> produce a table for me of offset against each variable in the
> structure to permit this sort of lookup?
This message would be more appropriate on the mailing list
gcc-help@gcc.gnu.org. Please take any followups to gcc-help. Thanks.
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.
Ian