From 41ad9c412827ed897bf37ae62a2035317652fa57 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 28 Apr 2015 10:03:55 +0000 Subject: [PATCH] LLDB-MI: -var-list-children with no children doesn't need a children 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 --- lldb/test/tools/lldb-mi/variable/TestMiVar.py | 8 ++++---- lldb/tools/lldb-mi/MICmdCmdVar.cpp | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lldb/test/tools/lldb-mi/variable/TestMiVar.py b/lldb/test/tools/lldb-mi/variable/TestMiVar.py index 93e1b87..543278f 100644 --- a/lldb/test/tools/lldb-mi/variable/TestMiVar.py +++ b/lldb/test/tools/lldb-mi/variable/TestMiVar.py @@ -47,7 +47,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): 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") @@ -67,7 +67,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): 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") @@ -87,7 +87,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): 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") @@ -107,7 +107,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): 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]\"") diff --git a/lldb/tools/lldb-mi/MICmdCmdVar.cpp b/lldb/tools/lldb-mi/MICmdCmdVar.cpp index dd3f196..83071fb 100644 --- a/lldb/tools/lldb-mi/MICmdCmdVar.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdVar.cpp @@ -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; -- 2.7.4