summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MICmdCmdGdbSet.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/MICmdCmdGdbSet.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/MICmdCmdGdbSet.cpp')
-rw-r--r--lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp b/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp
index ace147597ce..b5202cf7789 100644
--- a/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp
+++ b/lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp
@@ -21,6 +21,7 @@
// Instantiations:
const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t CMICmdCmdGdbSet::ms_mapGdbOptionNameToFnGdbOptionPtr = {
{"target-async", &CMICmdCmdGdbSet::OptionFnTargetAsync},
+ {"print", &CMICmdCmdGdbSet::OptionFnPrint},
// { "auto-solib-add", &CMICmdCmdGdbSet::OptionFnAutoSolibAdd }, // Example code if need to implement GDB set other options
{"output-radix", &CMICmdCmdGdbSet::OptionFnOutputRadix},
{"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
@@ -256,6 +257,50 @@ CMICmdCmdGdbSet::OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords)
}
//++ ------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB set option 'print-char-array-as-string' to
+// prepare and send back information asked for.
+// Type: Method.
+// Args: vrWords - (R) List of additional parameters used by this option.
+// Return: MIstatus::success - Function succeeded.
+// MIstatus::failure - Function failed.
+// Throws: None.
+//--
+bool
+CMICmdCmdGdbSet::OptionFnPrint(const CMIUtilString::VecString_t &vrWords)
+{
+ const bool bAllArgs(vrWords.size() == 2);
+ const bool bArgOn(bAllArgs && (CMIUtilString::Compare(vrWords[1], "on") || CMIUtilString::Compare(vrWords[1], "1")));
+ const bool bArgOff(bAllArgs && (CMIUtilString::Compare(vrWords[1], "off") || CMIUtilString::Compare(vrWords[1], "0")));
+ if (!bAllArgs || (!bArgOn && !bArgOff))
+ {
+ m_bGbbOptionFnHasError = true;
+ m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS);
+ return MIstatus::failure;
+ }
+
+ const CMIUtilString strOption(vrWords[0]);
+ CMIUtilString strOptionKey;
+ if (CMIUtilString::Compare(strOption, "char-array-as-string"))
+ strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintCharArrayAsString;
+ else
+ {
+ m_bGbbOptionFnHasError = true;
+ m_strGdbOptionFnError = CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION), strOption.c_str());
+ return MIstatus::failure;
+ }
+
+ const bool bOptionValue(bArgOn);
+ if (!m_rLLDBDebugSessionInfo.SharedDataAdd<bool>(strOptionKey, bOptionValue))
+ {
+ m_bGbbOptionFnHasError = false;
+ SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD), m_cmdData.strMiCmd.c_str(), strOptionKey.c_str()));
+ return MIstatus::failure;
+ }
+
+ return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
// Details: Carry out work to complete the GDB set option 'solib-search-path' to prepare
// and send back information asked for.
// Type: Method.
OpenPOWER on IntegriCloud