forked from OSchip/llvm-project
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 llvm-svn: 240631
This commit is contained in:
parent
3c49958945
commit
0b9e04b7c4
|
@ -122,7 +122,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
|
||||||
self.expect(r'\*stopped,reason="breakpoint-hit"')
|
self.expect(r'\*stopped,reason="breakpoint-hit"')
|
||||||
|
|
||||||
# Get address of local char[]
|
# 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]+"')
|
self.expect(r'\^done,value="0x[0-9a-f]+"')
|
||||||
addr = int(self.child.after.split('"')[1], 16)
|
addr = int(self.child.after.split('"')[1], 16)
|
||||||
size = 4
|
size = 4
|
||||||
|
|
|
@ -111,7 +111,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
|
||||||
|
|
||||||
# Print argument "argv[0]"
|
# Print argument "argv[0]"
|
||||||
self.runCmd("-data-evaluate-expression \"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.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.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")
|
self.runCmd("-var-evaluate-expression var6")
|
||||||
|
|
|
@ -125,7 +125,7 @@ CMICmdCmdDataEvaluateExpression::Execute(void)
|
||||||
lldb::SBValue value = frame.EvaluateExpression(rExpression.c_str());
|
lldb::SBValue value = frame.EvaluateExpression(rExpression.c_str());
|
||||||
if (!value.IsValid() || value.GetError().Fail())
|
if (!value.IsValid() || value.GetError().Fail())
|
||||||
value = frame.FindVariable(rExpression.c_str());
|
value = frame.FindVariable(rExpression.c_str());
|
||||||
const CMICmnLLDBUtilSBValue utilValue(value);
|
const CMICmnLLDBUtilSBValue utilValue(value, true);
|
||||||
if (!utilValue.IsValid() || utilValue.IsValueUnknown())
|
if (!utilValue.IsValid() || utilValue.IsValueUnknown())
|
||||||
{
|
{
|
||||||
m_bEvaluatedExpression = false;
|
m_bEvaluatedExpression = false;
|
||||||
|
@ -153,12 +153,7 @@ CMICmdCmdDataEvaluateExpression::Execute(void)
|
||||||
{
|
{
|
||||||
const lldb::ValueType eValueType = value.GetValueType();
|
const lldb::ValueType eValueType = value.GetValueType();
|
||||||
MIunused(eValueType);
|
MIunused(eValueType);
|
||||||
m_strValue = utilValue.GetValue();
|
m_strValue = utilValue.GetValue().Escape().AddSlashes();
|
||||||
CMIUtilString strCString;
|
|
||||||
if (CMICmnLLDBProxySBValue::GetCString(value, strCString))
|
|
||||||
{
|
|
||||||
m_strValue += CMIUtilString::Format(" '%s'", strCString.c_str());
|
|
||||||
}
|
|
||||||
return MIstatus::success;
|
return MIstatus::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue