On Fri, Feb 17, 2006 at 10:22:32PM +0200, Eli Zaretskii wrote:
Date: Fri, 17 Feb 2006 15:15:37 -0500
From: Daniel Jacobowitz <drow@false.org>
Cc: Vladimir Prus <ghost@cs.msu.su>, gdb@sources.redhat.com
The real problem here is that Vladimir is trying to parse the
result of
-data-evaluate-expression, which is defined as opaque. Maybe
someone
should design a major interface change where values are returned as
varobjs instead of strings.
Maybe, I don't know. If the results of -data-evaluate-expression are
designed to be unparsable, then indeed Vladimir shouldn't try that;
but then there should be some way of getting that information in an
easily parsable way.
What a great idea! Conveniently someone else already thought of
it :-)
-var-create - * "getpid()"
^done,name="var1",numchild="0",type="int"
(gdb)
-var-evaluate-expression var1
^done,value="31989"
(then -var-delete when you're done)
Now, this appears at first no different. It has an opaque value
string. And for functions it has the annoying {int (int)}. But
I think we've agreed that we can remove that, and for compound
values you can decompose it using -var-list-children, and you can
query
its formatted type separately:
-var-info-type var1
^done,type="int"
For the record, it evaluates the call at -var-create time rather than
-var-evaluate-expression, as I would hope. The result is somewhat
strange if GDB hits a breakpoint while doing so.
--
Daniel Jacobowitz
CodeSourcery