summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
diff options
context:
space:
mode:
authorIlia K <ki.stfu@gmail.com>2015-04-25 19:44:56 +0000
committerIlia K <ki.stfu@gmail.com>2015-04-25 19:44:56 +0000
commitaa82b4af84fb361077d3a984c1808fe7908d5c1f (patch)
tree6bc8da46f92c53130064261c27f678c54e362733 /lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
parenta44b37e6760bb5a27fa57558065f3c7a64d155a0 (diff)
downloadbcm5719-llvm-aa82b4af84fb361077d3a984c1808fe7908d5c1f.tar.gz
bcm5719-llvm-aa82b4af84fb361077d3a984c1808fe7908d5c1f.zip
Add -gdb-set/-gdb-show print char-array-as-string option (MI)
llvm-svn: 235804
Diffstat (limited to 'lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp')
-rw-r--r--lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp b/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
index 7176aaab7b1..1fe907110dd 100644
--- a/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ b/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -144,10 +144,25 @@ CMICmnLLDBUtilSBValue::GetSimpleValue(const bool vbHandleArrayType, CMIUtilStrin
return MIstatus::success;
}
}
- else if (IsArrayType() && vbHandleArrayType)
+ else if (IsArrayType())
{
- vwrValue = CMIUtilString::Format("[%u]", nChildren);
- return MIstatus::success;
+ CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
+ bool bPrintCharArrayAsString = false;
+ bPrintCharArrayAsString = rSessionInfo.SharedDataRetrieve<bool>(rSessionInfo.m_constStrPrintCharArrayAsString,
+ bPrintCharArrayAsString) && bPrintCharArrayAsString;
+ if (bPrintCharArrayAsString && m_bHandleCharType && IsFirstChildCharType())
+ {
+ // TODO: to match char* it should be the following
+ // vwrValue = CMIUtilString::Format("[%u] \"%s\"", nChildren, prefix.c_str());
+ const CMIUtilString prefix(GetValueCString().Escape().AddSlashes());
+ vwrValue = CMIUtilString::Format("\"%s\"", prefix.c_str());
+ return MIstatus::success;
+ }
+ else if (vbHandleArrayType)
+ {
+ vwrValue = CMIUtilString::Format("[%u]", nChildren);
+ return MIstatus::success;
+ }
}
// Composite variable type i.e. struct
OpenPOWER on IntegriCloud