diff options
author | Dawn Perchik <dawn@burble.org> | 2015-07-31 21:00:00 +0000 |
---|---|---|
committer | Dawn Perchik <dawn@burble.org> | 2015-07-31 21:00:00 +0000 |
commit | c18daf29ae8ca5edcceea7270dbf4b7bc682ca48 (patch) | |
tree | 3d1800e2f992a3138f903bb2c72eb47ca28c4b6e | |
parent | fe7e41e8f5fbde0c287b316a877a64e2ecd136a5 (diff) | |
download | bcm5719-llvm-c18daf29ae8ca5edcceea7270dbf4b7bc682ca48.tar.gz bcm5719-llvm-c18daf29ae8ca5edcceea7270dbf4b7bc682ca48.zip |
[lldb-mi] Fix evaluation for children of created variable object.
Move code in CMICmdCmdVarListChildren::Execute() up so that the child
object will always be added when the MI command -var-list-children is
entered (instead of only when the print-value was all or simple). This
patch fixes evaluation of expressions like varobj.member for a created
varobj with children.
Reviewed by: abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11659
llvm-svn: 243782
-rw-r--r-- | lldb/test/tools/lldb-mi/variable/TestMiVar.py | 11 | ||||
-rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdVar.cpp | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lldb/test/tools/lldb-mi/variable/TestMiVar.py b/lldb/test/tools/lldb-mi/variable/TestMiVar.py index e8813c4e647..de384c5828b 100644 --- a/lldb/test/tools/lldb-mi/variable/TestMiVar.py +++ b/lldb/test/tools/lldb-mi/variable/TestMiVar.py @@ -256,6 +256,17 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): 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") diff --git a/lldb/tools/lldb-mi/MICmdCmdVar.cpp b/lldb/tools/lldb-mi/MICmdCmdVar.cpp index 97270ec6d65..5702c9f9d34 100644 --- a/lldb/tools/lldb-mi/MICmdCmdVar.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdVar.cpp @@ -1019,6 +1019,9 @@ CMICmdCmdVarListChildren::Execute(void) 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 @@ CMICmdCmdVarListChildren::Execute(void) 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); |