Author: abidh Date: Fri May 29 11:48:40 2015 New Revision: 238572 URL: http://llvm.org/viewvc/llvm-project?rev=238572&view=rev Log: Improve handling of print value argument in -stack-list-* commands.
It was reviewed in http://reviews.llvm.org/D10106. Patch by paulmaybee. Modified: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Modified: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?rev=238572&r1=238571&r2=238572&view=diff ============================================================================== --- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (original) +++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py Fri May 29 11:48:40 2015 @@ -48,9 +48,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test that -stack-list-arguments lists stack arguments with simple values self.runCmd("-stack-list-arguments 2 0 1") - self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}") + self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}") self.runCmd("-stack-list-arguments --simple-values 0 1") - self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}") + self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}") # Test that an invalid low-frame is handled # FIXME: -1 is treated as unsigned int @@ -114,9 +114,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-locals: use 2 or --simple-values self.runCmd("-stack-list-locals 2") - self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]") + self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]") self.runCmd("-stack-list-locals --simple-values") - self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]") + self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]") # Test struct local variable: # Run to BP_local_struct_test @@ -141,9 +141,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-locals: use 2 or --simple-values self.runCmd("-stack-list-locals 2") - self.expect("\^done,locals=\[name=\"var_c\"\]") + self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]") self.runCmd("-stack-list-locals --simple-values") - self.expect("\^done,locals=\[name=\"var_c\"\]") + self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]") # Test array local variable: # Run to BP_local_array_test @@ -168,9 +168,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-locals: use 2 or --simple-values self.runCmd("-stack-list-locals 2") - self.expect("\^done,locals=\[name=\"array\"\]") + self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]") self.runCmd("-stack-list-locals --simple-values") - self.expect("\^done,locals=\[name=\"array\"\]") + self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]") # Test pointers as local variable: # Run to BP_local_pointer_test @@ -195,9 +195,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-locals: use 2 or --simple-values self.runCmd("-stack-list-locals 2") - self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]") + self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") self.runCmd("-stack-list-locals --simple-values") - self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]") + self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -241,9 +241,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-variables: use 2 or --simple-values self.runCmd("-stack-list-variables 2") - self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]") self.runCmd("-stack-list-variables --simple-values") - self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]") # Test struct local variable: # Run to BP_local_struct_test @@ -268,9 +268,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-variables: use 2 or --simple-values self.runCmd("-stack-list-variables 2") - self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]") self.runCmd("-stack-list-variables --simple-values") - self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]") # Test array local variable: # Run to BP_local_array_test @@ -295,9 +295,9 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-variables: use 2 or --simple-values self.runCmd("-stack-list-variables 2") - self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]") self.runCmd("-stack-list-variables --simple-values") - self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]") # Test pointers as local variable: # Run to BP_local_pointer_test @@ -322,10 +322,10 @@ class MiStackTestCase(lldbmi_testcase.Mi # Test -stack-list-variables: use 2 or --simple-values self.runCmd("-stack-list-variables 2") - self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",value=\".*?\"},{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]") + self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") self.runCmd("-stack-list-variables --simple-values") - self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",value=\".*?\"},{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]") - + self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") + @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp?rev=238572&r1=238571&r2=238572&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Fri May 29 11:48:40 2015 @@ -477,6 +477,13 @@ CMICmnLLDBDebugSessionInfo::MIResponseFo } if (veVarInfoFormat != eVariableInfoFormat_NoValues) { + miValueTuple.Add(miValueResultName); // name + if (veVarInfoFormat == eVariableInfoFormat_SimpleValues) + { + const CMICmnMIValueConst miValueConst3(value.GetTypeName()); + const CMICmnMIValueResult miValueResult3("type", miValueConst3); + miValueTuple.Add(miValueResult3); + } const MIuint nChildren = value.GetNumChildren(); const bool bIsPointerType = value.GetType().IsPointerType(); if (nChildren == 0 || // no children @@ -488,12 +495,11 @@ CMICmnLLDBDebugSessionInfo::MIResponseFo { const CMICmnMIValueConst miValueConst2(strValue.Escape().AddSlashes()); const CMICmnMIValueResult miValueResult2("value", miValueConst2); - miValueTuple.Add(miValueResultName); // name miValueTuple.Add(miValueResult2); - vwrMiValueList.Add(miValueTuple); - continue; } } + vwrMiValueList.Add(miValueTuple); + continue; } if (vbMarkArgs) _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits