summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/Platform.cpp10
-rw-r--r--tools/lldb-mi/MICmdCmdEnviro.cpp7
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.cpp34
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.h1
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.cpp22
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.h1
-rw-r--r--tools/lldb-mi/MICmdCmdMiscellanous.cpp20
-rw-r--r--tools/lldb-mi/MICmdCmdTarget.cpp1
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.cpp8
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.h4
-rw-r--r--tools/lldb-perf/lib/Results.cpp6
11 files changed, 97 insertions, 17 deletions
diff --git a/tools/driver/Platform.cpp b/tools/driver/Platform.cpp
index 1a58d4de03e40..b1b7de8e8a228 100644
--- a/tools/driver/Platform.cpp
+++ b/tools/driver/Platform.cpp
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include "Platform.h"
+#include "llvm/Support/ErrorHandling.h"
int ioctl(int d, int request, ...) {
switch (request) {
@@ -34,9 +35,8 @@ int ioctl(int d, int request, ...) {
return 0;
} break;
default:
- assert(!"Not implemented!");
+ llvm_unreachable("Not implemented!");
}
- return -1;
}
int kill(pid_t pid, int sig) {
@@ -44,13 +44,11 @@ int kill(pid_t pid, int sig) {
if (pid == getpid())
exit(sig);
//
- assert(!"Not implemented!");
- return -1;
+ llvm_unreachable("Not implemented!");
}
int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
- assert(!"Not implemented!");
- return -1;
+ llvm_unreachable("Not implemented!");
}
int tcgetattr(int fildes, struct termios *termios_p) {
diff --git a/tools/lldb-mi/MICmdCmdEnviro.cpp b/tools/lldb-mi/MICmdCmdEnviro.cpp
index 808e8f6c49c59..298fe0d57becd 100644
--- a/tools/lldb-mi/MICmdCmdEnviro.cpp
+++ b/tools/lldb-mi/MICmdCmdEnviro.cpp
@@ -94,6 +94,13 @@ bool CMICmdCmdEnvironmentCd::Execute() {
m_cmdData.strMiCmd.c_str(),
"SetCurrentPlatformSDKRoot()"));
+ lldb::SBTarget sbTarget = m_rLLDBDebugSessionInfo.GetTarget();
+ if (sbTarget.IsValid()) {
+ lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo();
+ sbLaunchInfo.SetWorkingDirectory(strWkDir.c_str());
+ sbTarget.SetLaunchInfo(sbLaunchInfo);
+ }
+
return bOk;
}
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.cpp b/tools/lldb-mi/MICmdCmdGdbSet.cpp
index 38b81facc432e..9f7325c931fc7 100644
--- a/tools/lldb-mi/MICmdCmdGdbSet.cpp
+++ b/tools/lldb-mi/MICmdCmdGdbSet.cpp
@@ -27,6 +27,7 @@ const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t
// Example code if need to implement GDB set other options
{"output-radix", &CMICmdCmdGdbSet::OptionFnOutputRadix},
{"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
+ {"disassembly-flavor", &CMICmdCmdGdbSet::OptionFnDisassemblyFlavor},
{"fallback", &CMICmdCmdGdbSet::OptionFnFallback}};
//++
@@ -399,6 +400,39 @@ bool CMICmdCmdGdbSet::OptionFnOutputRadix(
//++
//------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB set option 'disassembly-flavor'
+// to prepare
+// and send back information asked for.
+// Type: Method.
+// Args: vrWords - (R) List of additional parameters used by this option.
+// Return: MIstatus::success - Functional succeeded.
+// MIstatus::failure - Functional failed.
+// Throws: None.
+//--
+bool CMICmdCmdGdbSet::OptionFnDisassemblyFlavor(
+ const CMIUtilString::VecString_t &vrWords) {
+ // Check we have at least one argument
+ if (vrWords.size() < 1) {
+ m_bGbbOptionFnHasError = true;
+ // m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
+ return MIstatus::failure;
+ }
+ const CMIUtilString &rStrValDisasmFlavor(vrWords[0]);
+
+ lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
+ lldb::SBError error = lldb::SBDebugger::SetInternalVariable(
+ "target.x86-disassembly-flavor", rStrValDisasmFlavor.c_str(),
+ rDbgr.GetInstanceName());
+ if (error.Fail()) {
+ m_strGdbOptionFnError = error.GetCString();
+ return MIstatus::failure;
+ }
+
+ return MIstatus::success;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Carry out work to complete the GDB set option to prepare and send
// back the
// requested information.
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.h b/tools/lldb-mi/MICmdCmdGdbSet.h
index 98017baf2b906..730754f7f82a9 100644
--- a/tools/lldb-mi/MICmdCmdGdbSet.h
+++ b/tools/lldb-mi/MICmdCmdGdbSet.h
@@ -79,6 +79,7 @@ private:
bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
+ bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
// Attributes:
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.cpp b/tools/lldb-mi/MICmdCmdGdbShow.cpp
index 591d80bb9d0af..4ae45f8579e24 100644
--- a/tools/lldb-mi/MICmdCmdGdbShow.cpp
+++ b/tools/lldb-mi/MICmdCmdGdbShow.cpp
@@ -13,6 +13,7 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBStringList.h"
#include "lldb/API/SBThread.h"
// In-house headers:
@@ -30,6 +31,7 @@ const CMICmdCmdGdbShow::MapGdbOptionNameToFnGdbOptionPtr_t
{"target-async", &CMICmdCmdGdbShow::OptionFnTargetAsync},
{"print", &CMICmdCmdGdbShow::OptionFnPrint},
{"language", &CMICmdCmdGdbShow::OptionFnLanguage},
+ {"disassembly-flavor", &CMICmdCmdGdbShow::OptionFnDisassemblyFlavor},
{"fallback", &CMICmdCmdGdbShow::OptionFnFallback}};
//++
@@ -327,6 +329,26 @@ bool CMICmdCmdGdbShow::OptionFnLanguage(
//++
//------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB show option 'disassembly-flavor' to prepare
+// and send back the requested information.
+// 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 CMICmdCmdGdbShow::OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords) {
+ MIunused(vrWords);
+
+ // Get current disassembly flavor
+ lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
+ m_strValue = lldb::SBDebugger::GetInternalVariableValue("target.x86-disassembly-flavor",
+ rDbgr.GetInstanceName()).GetStringAtIndex(0);
+ return MIstatus::success;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Carry out work to complete the GDB show option to prepare and send
// back the
// requested information.
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.h b/tools/lldb-mi/MICmdCmdGdbShow.h
index 9873e87c81208..452db827032ca 100644
--- a/tools/lldb-mi/MICmdCmdGdbShow.h
+++ b/tools/lldb-mi/MICmdCmdGdbShow.h
@@ -78,6 +78,7 @@ private:
bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
bool OptionFnLanguage(const CMIUtilString::VecString_t &vrWords);
+ bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
// Attributes:
diff --git a/tools/lldb-mi/MICmdCmdMiscellanous.cpp b/tools/lldb-mi/MICmdCmdMiscellanous.cpp
index f2aecbc32ed32..87c0ee62f6585 100644
--- a/tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ b/tools/lldb-mi/MICmdCmdMiscellanous.cpp
@@ -496,14 +496,22 @@ bool CMICmdCmdInterpreterExec::Execute() {
//--
bool CMICmdCmdInterpreterExec::Acknowledge() {
if (m_lldbResult.GetOutputSize() > 0) {
- CMIUtilString strMsg(m_lldbResult.GetOutput());
- strMsg = strMsg.StripCREndOfLine();
- CMICmnStreamStdout::TextToStdout(strMsg);
+ const CMIUtilString line(m_lldbResult.GetOutput());
+ const bool bEscapeQuotes(true);
+ CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
+ CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput, miValueConst);
+ const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
+ if (!bOk)
+ return MIstatus::failure;
}
if (m_lldbResult.GetErrorSize() > 0) {
- CMIUtilString strMsg(m_lldbResult.GetError());
- strMsg = strMsg.StripCREndOfLine();
- CMICmnStreamStderr::LLDBMsgToConsole(strMsg);
+ const CMIUtilString line(m_lldbResult.GetError());
+ const bool bEscapeQuotes(true);
+ CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
+ CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput, miValueConst);
+ const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
+ if (!bOk)
+ return MIstatus::failure;
}
const CMICmnMIResultRecord miRecordResult(
diff --git a/tools/lldb-mi/MICmdCmdTarget.cpp b/tools/lldb-mi/MICmdCmdTarget.cpp
index 15650163450bf..e5bd4c4d2bc7c 100644
--- a/tools/lldb-mi/MICmdCmdTarget.cpp
+++ b/tools/lldb-mi/MICmdCmdTarget.cpp
@@ -123,6 +123,7 @@ bool CMICmdCmdTargetSelect::Execute() {
// Verify that we have managed to connect successfully
lldb::SBStream errMsg;
+ error.GetDescription(errMsg);
if (!process.IsValid()) {
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_PLUGIN),
m_cmdData.strMiCmd.c_str(),
diff --git a/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp b/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
index 66a44e6084b14..029f76e65a856 100644
--- a/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
+++ b/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
@@ -48,6 +48,10 @@ MapOutOfBandToText(CMICmnMIOutOfBandRecord::OutOfBand_e veType) {
return "library-unloaded";
case CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput:
return "";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput:
+ return "";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput:
+ return "";
}
assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e");
return NULL;
@@ -86,6 +90,10 @@ MapOutOfBandToToken(CMICmnMIOutOfBandRecord::OutOfBand_e veType) {
return "=";
case CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput:
return "@";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput:
+ return "~";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput:
+ return "&";
}
assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e");
return NULL;
diff --git a/tools/lldb-mi/MICmnMIOutOfBandRecord.h b/tools/lldb-mi/MICmnMIOutOfBandRecord.h
index f81c114e66812..1bba38cf0ccad 100644
--- a/tools/lldb-mi/MICmnMIOutOfBandRecord.h
+++ b/tools/lldb-mi/MICmnMIOutOfBandRecord.h
@@ -65,7 +65,9 @@ public:
eOutOfBand_ThreadSelected,
eOutOfBand_TargetModuleLoaded,
eOutOfBand_TargetModuleUnloaded,
- eOutOfBand_TargetStreamOutput
+ eOutOfBand_TargetStreamOutput,
+ eOutOfBand_ConsoleStreamOutput,
+ eOutOfBand_LogStreamOutput
};
// Methods:
diff --git a/tools/lldb-perf/lib/Results.cpp b/tools/lldb-perf/lib/Results.cpp
index 17a022f2ea1c0..a4cdce525e2cb 100644
--- a/tools/lldb-perf/lib/Results.cpp
+++ b/tools/lldb-perf/lib/Results.cpp
@@ -76,8 +76,7 @@ static void AddResultToArray(CFCMutableArray &parent_array,
} break;
default:
- assert(!"unhandled result");
- break;
+ llvm_unreachable("unhandled result");
}
}
@@ -125,8 +124,7 @@ static void AddResultToDictionary(CFCMutableDictionary &parent_dict,
result->GetAsUnsigned()->GetValue(), true);
} break;
default:
- assert(!"unhandled result");
- break;
+ llvm_unreachable("unhandled result");
}
}
void Results::Write(const char *out_path) {