[Lldb-commits] [lldb] r240631 - Expand result with type char* to string in -data-evaluate-expression
Ilia K
ki.stfu at gmail.com
Thu Jun 25 04:10:12 PDT 2015
Author: ki.stfu
Date: Thu Jun 25 06:10:12 2015
New Revision: 240631
URL: http://llvm.org/viewvc/llvm-project?rev=240631&view=rev
Log:
Expand result with type char* to string in -data-evaluate-expression
Summary:
Expand result with type char* to string in -data-evaluate-expression.
was:
```
-data-evaluate-expression str
^done,value="0x00007fffffffece0"
```
now:
```
-data-evaluate-expression str
^done,value="0x00007fffffffece0 \"hello\""
```
All tests pass on Linux.
Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi
Reviewers: abidh
Reviewed By: abidh
Subscribers: lldb-commits, dawn, abidh
Differential Revision: http://reviews.llvm.org/D10728
Modified:
lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
Modified: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/TestMiData.py?rev=240631&r1=240630&r2=240631&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/test/tools/lldb-mi/data/TestMiData.py Thu Jun 25 06:10:12 2015
@@ -122,7 +122,7 @@ class MiDataTestCase(lldbmi_testcase.MiT
self.expect(r'\*stopped,reason="breakpoint-hit"')
# Get address of local char[]
- self.runCmd('-data-evaluate-expression &array')
+ self.runCmd('-data-evaluate-expression "(void *)&array"')
self.expect(r'\^done,value="0x[0-9a-f]+"')
addr = int(self.child.after.split('"')[1], 16)
size = 4
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=240631&r1=240630&r2=240631&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Thu Jun 25 06:10:12 2015
@@ -111,7 +111,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Print argument "argv[0]"
self.runCmd("-data-evaluate-expression \"argv[0]\"")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
+ self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
self.runCmd("-var-create var6 * \"argv[0]\"")
self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe)
self.runCmd("-var-evaluate-expression var6")
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=240631&r1=240630&r2=240631&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Thu Jun 25 06:10:12 2015
@@ -125,7 +125,7 @@ CMICmdCmdDataEvaluateExpression::Execute
lldb::SBValue value = frame.EvaluateExpression(rExpression.c_str());
if (!value.IsValid() || value.GetError().Fail())
value = frame.FindVariable(rExpression.c_str());
- const CMICmnLLDBUtilSBValue utilValue(value);
+ const CMICmnLLDBUtilSBValue utilValue(value, true);
if (!utilValue.IsValid() || utilValue.IsValueUnknown())
{
m_bEvaluatedExpression = false;
@@ -153,12 +153,7 @@ CMICmdCmdDataEvaluateExpression::Execute
{
const lldb::ValueType eValueType = value.GetValueType();
MIunused(eValueType);
- m_strValue = utilValue.GetValue();
- CMIUtilString strCString;
- if (CMICmnLLDBProxySBValue::GetCString(value, strCString))
- {
- m_strValue += CMIUtilString::Format(" '%s'", strCString.c_str());
- }
+ m_strValue = utilValue.GetValue().Escape().AddSlashes();
return MIstatus::success;
}
More information about the lldb-commits
mailing list