Parse and retrieve members of a structure

Jonathan Wakely jwakely.gcc@gmail.com
Fri Jan 13 10:40:00 GMT 2012


On 13 January 2012 09:30, Shakthi Kannan wrote:
> Hi,
>
> I would like to know if there are any flags or options that can be
> passed to gcc to retrieve the members of a struct {}?

What do you mean by retrieve?  Get a list of member names? Names and
types? Offsets? At runtime? At compile time?

(I think the answer's no, in any case.)

> I want to be
> able to compute a CRC checksum for each member of a structure in a .c
> or .h file.

Again, I'm not sure what you mean. Do you mean compute a checksum of
the values, or the layout, or something else?  At runtime, or before
the program runs? Or after?

> Or, if there is any other way to do it, please do let me know.

You can retrieve information on object layout from DWARF debugging info.



More information about the Gcc-help mailing list