[Bug 23326] New: Output from stack-list-locals and stack-list-arguments MI commands missing type information

Bug ID 23326
Summary Output from stack-list-locals and stack-list-arguments MI commands missing type information
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter vadim.macagon@gmail.com
Classification Unclassified

Created attachment 14248 [details]
Source for test executable

The stack-list-locals and stack-list-arguments MI commands have three output
modes, described as follows:
[0|--no-values] - Only variable/argument names are output.
[1|--all-values] - Variable/argument names and values are output.
[2|--simple-values] - Variable/argument names, values, and types are output for
simple types, but only names and types are output for complex types (like
arrays, structs, unions, etc.)

Full descriptions of these MI commands are available at
<[https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation](https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation)>

It is the --simple-values output mode that hasn't been implemented properly in
the LLDB MI driver, no type information is output at all. Here's an example of
what GDB and LLDB output for the '-stack-list-arguments --simple-values'
command:

GDB-MI:
^done,stack-args=[frame={level="0",args=[]},frame={level="1",args=[]},frame={level="2",args=[{name="argc",type="int",value="1"},{name="argv",type="const
char **",value="0x7fffffffde68"}]}]

LLDB-MI:
^done,stack-args=[frame={level="0",args=[]},frame={level="1",args=[]},frame={level="2",args=[{name="argc",value="1"},{name="argv",value="0x00007fffffffee58"}]}]

And here's an example of what GDB and LLDB output for the '-stack-list-locals
--simple-values' command:

GDB-MI:
^done,locals=[{name="e",type="Point"},{name="f",type="float",value="9.5"},{name="g",type="long",value="300"}]

LLDB-MI:
^done,locals=[name="e",{name="f",value="9.5"},{name="g",value="300"}]

Note that aside from missing type information in the LLDB-MI response above,
it's not even grammatically correct, according to the 'list' rule a list
delimited by [] should either contain only results (key=value), or only values.
In this case the grammatically correct output would've been:

^done,locals=[{name="e"},{name="f",value="9.5"},{name="g",value="300"}]

I've attached the source file I've used to produce the example output in this
bug report, once built in debug mode the following MI commands can be used to
reproduce the examples in GDB (gdb --interperter mi) or LLDB (lldb-mi
--interperter):

-file-exec-and-symbols path/to/test_target
-break-insert funcWithThreeLocalVariables_Inner
-exec-run
-stack-list-arguments 2
-stack-list-locals --frame 1 --thread 1 2

Note that LLDB outputs a couple of extra frames for stack-list-arguments that
I've omitted from the example output above.

abidh changed bug 23326