[Lldb-commits] [PATCH] Expand result with type char* to string in -data-evaluate-expression
Ilia K
ki.stfu at gmail.com
Thu Jun 25 03:02:21 PDT 2015
Hi abidh,
Expand result with type char* to string in -data-evaluate-expression.
All tests pass on Linux.
http://reviews.llvm.org/D10728
Files:
test/tools/lldb-mi/data/TestMiData.py
test/tools/lldb-mi/variable/TestMiVar.py
tools/lldb-mi/MICmdCmdData.cpp
Index: test/tools/lldb-mi/data/TestMiData.py
===================================================================
--- test/tools/lldb-mi/data/TestMiData.py
+++ test/tools/lldb-mi/data/TestMiData.py
@@ -122,7 +122,7 @@
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
Index: test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- test/tools/lldb-mi/variable/TestMiVar.py
+++ test/tools/lldb-mi/variable/TestMiVar.py
@@ -111,7 +111,7 @@
# 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")
Index: tools/lldb-mi/MICmdCmdData.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdData.cpp
+++ tools/lldb-mi/MICmdCmdData.cpp
@@ -125,7 +125,7 @@
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 @@
{
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;
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10728.28443.patch
Type: text/x-patch
Size: 2396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150625/5fafd2bf/attachment.bin>
More information about the lldb-commits
mailing list