Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Christoph Jaeschke <cjaeschke@onlinehome.de>
To: gdb@sources.redhat.com
Subject: Proposal: offset based member name (or type) lookup
Date: Sun, 04 Jan 2004 17:09:00 -0000	[thread overview]
Message-ID: <3FF853B5.7020107@onlinehome.de> (raw)

Hi,

I would like to propose a offset based member name lookup of
structs/classes. Assume:

     struct X {
         int a;
         int b;
     };

     struct Y {
         struct X x[4];
         int c;
     };

     struct Z {
         Y  y;
     };

If you apply a patch for gdb 6.0 I've prepared, you can ask gdb by

     ptype Z + 28

about Z's relative name at offset 28

     .y.x[3].b

using

     ptype Z+28, typechain

gdb will append also the typechain

     .y.x[3].b, typechain = ::Y::X[4]::int


There may be a better suited command than 'ptype' for it, it was choosen 
just because it was the simplest way to add it.

The patch contains also a caching mechanism, speeding up a lot if you do 
many lookups in big nested structures. It has a minimal memory 
requirement and will not hurt for single lookups.

The patch can be send if you are interested in.

     Christoph Jaeschke


             reply	other threads:[~2004-01-04 17:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-04 17:09 Christoph Jaeschke [this message]
2004-01-04 17:25 ` Daniel Jacobowitz
2004-01-04 17:30   ` Daniel Jacobowitz
2004-01-04 19:10     ` Christoph Jaeschke
2004-01-08  1:28     ` Andrew Cagney
2004-02-27 21:09 Christoph Jaeschke

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=3FF853B5.7020107@onlinehome.de \
    --to=cjaeschke@onlinehome.de \
    --cc=gdb@sources.redhat.com \
    --cc=no.spam.cjaeschke@onlinehome.de \
    /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