public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Parse and retrieve members of a structure
@ 2012-01-13 10:32 Shakthi Kannan
  2012-01-13 10:40 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Shakthi Kannan @ 2012-01-13 10:32 UTC (permalink / raw)
  To: gcc-help

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 {}? I want to be
able to compute a CRC checksum for each member of a structure in a .c
or .h file.

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

Thanks,

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Parse and retrieve members of a structure
  2012-01-13 10:32 Parse and retrieve members of a structure Shakthi Kannan
@ 2012-01-13 10:40 ` Jonathan Wakely
  2012-01-13 12:58   ` Shakthi Kannan
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2012-01-13 10:40 UTC (permalink / raw)
  To: Shakthi Kannan; +Cc: gcc-help

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Parse and retrieve members of a structure
  2012-01-13 10:40 ` Jonathan Wakely
@ 2012-01-13 12:58   ` Shakthi Kannan
  0 siblings, 0 replies; 3+ messages in thread
From: Shakthi Kannan @ 2012-01-13 12:58 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Hi Jonathan:

--- On Fri, Jan 13, 2012 at 3:32 PM, Jonathan Wakely
<jwakely.gcc@gmail.com> wrote:
| What do you mean by retrieve?  Get a list of member names? Names and types?
| Offsets? At runtime? At compile time?
\--

Yes, for names, types and offsets at compile time. Sorry to have not
been specific when asking the question.

---
| Again, I'm not sure what you mean. Do you mean compute a checksum of
| the values, or the layout, or something else?
\--

Checksum of the individual values during compile time.

The genksyms tool in the Linux kernel sources provides a CRC checksum
of exported functions. I would like to know if something similar can
be done for a structure and its members.

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

I will look into this.

Thanks for your reply,

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-13 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 10:32 Parse and retrieve members of a structure Shakthi Kannan
2012-01-13 10:40 ` Jonathan Wakely
2012-01-13 12:58   ` Shakthi Kannan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).