This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Proposal: offset based member name (or type) lookup
- From: Christoph Jaeschke <cjaeschke at onlinehome dot de>
- To: gdb at sources dot redhat dot com
- Date: Sun, 04 Jan 2004 18:56:05 +0100
- Subject: Proposal: offset based member name (or type) lookup
- Reply-to: no dot spam dot cjaeschke at onlinehome dot de
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