Skip to content

Commit

Permalink
LLDB-MI: -var-list-children with no children doesn't need a children …
Browse files Browse the repository at this point in the history
…value in the response.

Summary:
When using GDB with MI, if there aren't children for a variable,
it doesn't include a "children" value in the response. LLDB does
and sets it to "[]" while variables with children have an unquoted
list: children=[...].

This removes the children value entirely when there are no children
making this match GDB in behavior.

Test Plan: Ran tests on Mac OS X and they passed.

Reviewers: abidh, domipheus

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9320

llvm-svn: 235974
  • Loading branch information
waywardmonkeys committed Apr 28, 2015
1 parent ae51853 commit 41ad9c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lldb/test/tools/lldb-mi/variable/TestMiVar.py
Expand Up @@ -47,7 +47,7 @@ def test_lldbmi_eval(self):
self.runCmd("-var-show-attributes var2")
self.expect("\^done,status=\"editable\"")
self.runCmd("-var-list-children var2")
self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.expect("\^done,numchild=\"0\"")
self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
self.expect("\^done,value=\"30\"")
self.runCmd("-var-update --all-values var2")
Expand All @@ -67,7 +67,7 @@ def test_lldbmi_eval(self):
self.runCmd("-var-show-attributes var3")
self.expect("\^done,status=\"editable\"")
self.runCmd("-var-list-children var3")
self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.expect("\^done,numchild=\"0\"")
self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
self.expect("\^done,value=\"3\"")
self.runCmd("-var-update --all-values var3")
Expand All @@ -87,7 +87,7 @@ def test_lldbmi_eval(self):
self.runCmd("-var-show-attributes var4")
self.expect("\^done,status=\"editable\"")
self.runCmd("-var-list-children var4")
self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.expect("\^done,numchild=\"0\"")
self.runCmd("-data-evaluate-expression \"b=2\"")
self.expect("\^done,value=\"2\"")
self.runCmd("-var-update --all-values var4")
Expand All @@ -107,7 +107,7 @@ def test_lldbmi_eval(self):
self.runCmd("-var-show-attributes var5")
self.expect("\^done,status=\"editable\"") #FIXME editable or not?
self.runCmd("-var-list-children var5")
self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.expect("\^done,numchild=\"0\"")

# Print argument "argv[0]"
self.runCmd("-data-evaluate-expression \"argv[0]\"")
Expand Down
7 changes: 1 addition & 6 deletions lldb/tools/lldb-mi/MICmdCmdVar.cpp
Expand Up @@ -1099,12 +1099,7 @@ CMICmdCmdVarListChildren::Acknowledge(void)
CMICmnMIValueResult miValueResult("numchild", miValueConst);

VecMIValueResult_t::const_iterator it = m_vecMiValueResult.begin();
if (it == m_vecMiValueResult.end())
{
const CMICmnMIValueConst miValueConst("[]");
miValueResult.Add("children", miValueConst);
}
else
if (it != m_vecMiValueResult.end())
{
CMICmnMIValueList miValueList(*it);
++it;
Expand Down

0 comments on commit 41ad9c4

Please sign in to comment.