This revision was automatically updated to reflect the committed changes.
Closed by commit rL243782: [lldb-mi] Fix evaluation for children of created 
variable object. (authored by dperchik).

Changed prior to commit:
  http://reviews.llvm.org/D11659?vs=31065&id=31162#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11659

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

Index: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
@@ -1019,6 +1019,9 @@
         const MIuint nChildren = member.GetNumChildren();
         const CMIUtilString strThreadId(CMIUtilString::Format("%u", 
member.GetThread().GetIndexID()));
 
+        // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static 
container of varObjs
+        CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, 
rVarObjName);
+
         // MI print 
"child={name=\"%s\",exp=\"%s\",numchild=\"%d\",value=\"%s\",type=\"%s\",thread-id=\"%u\",has_more=\"%u\"}"
         const CMICmnMIValueConst miValueConst(name);
         const CMICmnMIValueResult miValueResult("name", miValueConst);
@@ -1040,8 +1043,6 @@
         if (eVarInfoFormat == 
CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues ||
             (eVarInfoFormat == 
CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues && nChildren == 0))
         {
-            // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static 
container of varObjs
-            CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, 
rVarObjName);
             const CMIUtilString strValue(
             CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(member, 
CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural));
             const CMICmnMIValueConst miValueConst7(strValue);
Index: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
@@ -256,6 +256,17 @@
         self.runCmd("-var-create var_pcomplx * pcomplx")
         
self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
 
+        # Test that -var-evaluate-expression can evaluate the children of 
created varobj
+        self.runCmd("-var-list-children var_complx")
+        self.runCmd("-var-evaluate-expression var_complx.i")
+        self.expect("\^done,value=\"3\"")
+        self.runCmd("-var-list-children var_complx_array")
+        self.runCmd("-var-evaluate-expression var_complx_array.[0]")
+        self.expect("\^done,value=\"\{...\}\"")
+        self.runCmd("-var-list-children var_pcomplx")
+        self.runCmd("-var-evaluate-expression var_pcomplx.complex_type")
+        self.expect("\^done,value=\"\{...\}\"")
+
         # Test that -var-list-children lists empty children if range is empty
         # (and that print-values is optional)
         self.runCmd("-var-list-children var_complx 0 0")


Index: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
@@ -1019,6 +1019,9 @@
         const MIuint nChildren = member.GetNumChildren();
         const CMIUtilString strThreadId(CMIUtilString::Format("%u", member.GetThread().GetIndexID()));
 
+        // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static container of varObjs
+        CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, rVarObjName);
+
         // MI print "child={name=\"%s\",exp=\"%s\",numchild=\"%d\",value=\"%s\",type=\"%s\",thread-id=\"%u\",has_more=\"%u\"}"
         const CMICmnMIValueConst miValueConst(name);
         const CMICmnMIValueResult miValueResult("name", miValueConst);
@@ -1040,8 +1043,6 @@
         if (eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues ||
             (eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues && nChildren == 0))
         {
-            // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static container of varObjs
-            CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, rVarObjName);
             const CMIUtilString strValue(
             CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(member, CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural));
             const CMICmnMIValueConst miValueConst7(strValue);
Index: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
@@ -256,6 +256,17 @@
         self.runCmd("-var-create var_pcomplx * pcomplx")
         self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
 
+        # Test that -var-evaluate-expression can evaluate the children of created varobj
+        self.runCmd("-var-list-children var_complx")
+        self.runCmd("-var-evaluate-expression var_complx.i")
+        self.expect("\^done,value=\"3\"")
+        self.runCmd("-var-list-children var_complx_array")
+        self.runCmd("-var-evaluate-expression var_complx_array.[0]")
+        self.expect("\^done,value=\"\{...\}\"")
+        self.runCmd("-var-list-children var_pcomplx")
+        self.runCmd("-var-evaluate-expression var_pcomplx.complex_type")
+        self.expect("\^done,value=\"\{...\}\"")
+
         # Test that -var-list-children lists empty children if range is empty
         # (and that print-values is optional)
         self.runCmd("-var-list-children var_complx 0 0")
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to