This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI] -stack-list-variables
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 19 Sep 2009 14:13:35 +0400
- Subject: Re: [MI] -stack-list-variables
- References: <200909191412.37692.vladimir@codesourcery.com>
Vladimir Prus wrote:
>
> MI presently have two separate commands to list locals and arguments in
> the current frame. Most often than not, frontend need both, so having
> to emit two commands is inconvenience and and extra roundtrip. I believe
> Nick has suggested having a single command, and Andre is in favour of
> this idea, and I also think it's good. I actually recall than Nick planned
> to write a patch, but I did not saw any, and this is fairly trivial
> change, so here it goes. The new command is called -stack-list-variables,
> and it's checked in into CVS HEAD.
>
> I'll post doc patch shortly; I will also merge this to 7.0 after a couple
> of days, if no issues appear.
And here's the doc patch.
- Volodya
? ChangeLog.lines
? ChangeLog.my
? all
? my
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.626
diff -u -p -r1.626 gdb.texinfo
--- gdb.texinfo 18 Sep 2009 18:03:45 -0000 1.626
+++ gdb.texinfo 19 Sep 2009 10:10:47 -0000
@@ -23130,6 +23130,9 @@ The @var{show-values} argument must have
0 means that only the names of the arguments are listed, a value of 1
means that both names and values of the arguments are printed.
+Use of this command to obtain arguments in a single frame is
+deprecated in favor of the @samp{-stack-list-variables} command.
+
@subsubheading @value{GDBN} Command
@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
@@ -23314,6 +23317,9 @@ display the value of simple data types a
other data types when the user wishes to explore their values in
more detail.
+This command is deprecated in favor of the
+@samp{-stack-list-variables} command.
+
@subsubheading @value{GDBN} Command
@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
@@ -23334,6 +23340,31 @@ more detail.
(gdb)
@end smallexample
+@subheading The @code{-stack-list-variables} Command
+@findex -stack-list-variables
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-variables @var{print-values}
+@end smallexample
+
+Display the names of local variables and function arguments for the selected frame. If
+@var{print-values} is 0 or @code{--no-values}, print only the names of
+the variables; if it is 1 or @code{--all-values}, print also their
+values; and if it is 2 or @code{--simple-values}, print the name,
+type and value for simple data types and the name and type for arrays,
+structures and unions.
+
+@subsubheading Example
+
+@smallexample
+(gdb)
+-stack-list-variables --thread 1 --frame 0 --all-values
+^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
+(gdb)
+@end smallexample
+
@subheading The @code{-stack-select-frame} Command
@findex -stack-select-frame