From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Cc: gdb@sourceware.org
Subject: Re: struct/class members using mi interface
Date: Thu, 21 Jul 2011 04:36:00 -0000 [thread overview]
Message-ID: <20110721043531.GA1440@host1.jankratochvil.net> (raw)
In-Reply-To: <SNT105-DS1110B4AACA27BE5D418168934C0@phx.gbl>
On Wed, 20 Jul 2011 08:24:45 +0200, Alistair Leslie-Hughes wrote:
> Using the mi interface, is there a way to retrieve all the member
> variables of a class/struct?
yes, for samples one can check/run gdb/testsuite/gdb.mi/*.exp (first part
below) or I also sniffed Eclipse CDT communication by setting its gdb command
to a script (second part below).
Regards,
Jan
-var-create var1 * a
^done,name="var1",numchild="3",value="{...}",type="A",thread-id="1",has_more="0"
-var-list-children var1
^done,numchild="3",children=[child={name="var1.public",exp="public",numchild="2",thread-id="1"},child={name="var1.private",exp="private",numchild="2",thread-id="1"},child={name="var1.protected",exp="protected",numchild="2",thread-id="1"}],has_more="0"
-var-list-children var1.public
^done,numchild="2",children=[child={name="var1.public.x",exp="x",numchild="0",type="int",thread-id="1"},child={name="var1.public.buffer",exp="buffer",numchild="10",type="char
[10]",thread-id="1"}],has_more="0"
-var-list-children var1.private
^done,numchild="2",children=[child={name="var1.private.u",exp="u",numchild="0",type="int",thread-id="1"},child={name="var1.private.z",exp="z",numchild="0",type="float",thread-id="1"}],has_more="0"
-var-list-children var1.protected
^done,numchild="2",children=[child={name="var1.protected.y",exp="y",numchild="0",type="int",thread-id="1"},child={name="var1.protected.b",exp="b",numchild="2",type="B",thread-id="1"}],has_more="0"
-var-list-children var1.protected.b
^done,numchild="2",children=[child={name="var1.protected.b.public",exp="public",numchild="2",thread-id="1"},child={name="var1.protected.b.private",exp="private",numchild="1",thread-id="1"}],has_more="0"
------------------------------------------------------------------------------
#! /bin/sh
TMP=/tmp
if [ -d $TMP/server ];then
TMP=$TMP/server
fi
DIR=$TMP/gdb.d
mkdir -p $DIR
i=0
while true;do
FILE=$DIR/`printf %02d $i`
if ! test -f $FILE;then
break
fi
i=$[$i+1]
done
tee $FILE.in | "$0"-orig "$@" | tee $FILE.out
next prev parent reply other threads:[~2011-07-21 4:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 10:13 Alistair Leslie-Hughes
2011-07-21 4:36 ` Jan Kratochvil [this message]
2011-07-21 13:55 ` Tom Tromey
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=20110721043531.GA1440@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb@sourceware.org \
--cc=leslie_alistair@hotmail.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