public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: <Paul_Koning@Dell.com>
To: <james.dutton@gmail.com>
Cc: <gcc@gcc.gnu.org>
Subject: RE: structure offset to structure name conversion.
Date: Thu, 27 Oct 2011 21:32:00 -0000	[thread overview]
Message-ID: <09787EF419216C41A903FD14EE5506DD030CF1677D@AUSX7MCPC103.AMER.DELL.COM> (raw)
In-Reply-To: <mcrr51y2ppv.fsf@dhcp-172-18-216-180.mtv.corp.google.com>

> 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

      reply	other threads:[~2011-10-27 19:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27 19:29 James Courtier-Dutton
2011-10-27 20:30 ` Ian Lance Taylor
2011-10-27 21:32   ` Paul_Koning [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09787EF419216C41A903FD14EE5506DD030CF1677D@AUSX7MCPC103.AMER.DELL.COM \
    --to=paul_koning@dell.com \
    --cc=gcc@gcc.gnu.org \
    --cc=james.dutton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).