[Lldb-commits] [lldb] r235974 - LLDB-MI: -var-list-children with no children doesn't need a children value in the response.

Bruce Mitchener bruce.mitchener at gmail.com
Tue Apr 28 03:03:56 PDT 2015


Author: brucem
Date: Tue Apr 28 05:03:55 2015
New Revision: 235974

URL: http://llvm.org/viewvc/llvm-project?rev=235974&view=rev
Log:
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

Modified:
    lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
    lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp

Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=235974&r1=235973&r2=235974&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Tue Apr 28 05:03:55 2015
@@ -47,7 +47,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
         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.MiTe
         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.MiTe
         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.MiTe
         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]\"")

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=235974&r1=235973&r2=235974&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Tue Apr 28 05:03:55 2015
@@ -1099,12 +1099,7 @@ CMICmdCmdVarListChildren::Acknowledge(vo
         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;





More information about the lldb-commits mailing list