This is the mail archive of the gcc@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.


> 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?

GDB can do this, of course.  There is also a utility "pahole" that reads debug data from an object file or executable file and produces that information.  See your favorite search engine.

	paul


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