Index: tools/lldb-mi/MICmdCmdEnviro.cpp =================================================================== --- tools/lldb-mi/MICmdCmdEnviro.cpp +++ tools/lldb-mi/MICmdCmdEnviro.cpp @@ -94,6 +94,13 @@ 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; } Index: tools/lldb-mi/MICmdCmdGdbSet.h =================================================================== --- tools/lldb-mi/MICmdCmdGdbSet.h +++ tools/lldb-mi/MICmdCmdGdbSet.h @@ -79,6 +79,7 @@ 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: Index: tools/lldb-mi/MICmdCmdGdbSet.cpp =================================================================== --- tools/lldb-mi/MICmdCmdGdbSet.cpp +++ tools/lldb-mi/MICmdCmdGdbSet.cpp @@ -27,6 +27,7 @@ // 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,31 @@ //++ //------------------------------------------------------------------------------------ +// 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::SBDebugger::SetInternalVariable("target.x86-disassembly-flavor", rStrValDisasmFlavor.c_str(), rDbgr.GetInstanceName()); + + return MIstatus::success; +} + +//++ +//------------------------------------------------------------------------------------ // Details: Carry out work to complete the GDB set option to prepare and send // back the // requested information. Index: tools/lldb-mi/MICmdCmdGdbShow.h =================================================================== --- tools/lldb-mi/MICmdCmdGdbShow.h +++ tools/lldb-mi/MICmdCmdGdbShow.h @@ -78,6 +78,7 @@ 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: Index: tools/lldb-mi/MICmdCmdGdbShow.cpp =================================================================== --- tools/lldb-mi/MICmdCmdGdbShow.cpp +++ 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 @@ {"target-async", &CMICmdCmdGdbShow::OptionFnTargetAsync}, {"print", &CMICmdCmdGdbShow::OptionFnPrint}, {"language", &CMICmdCmdGdbShow::OptionFnLanguage}, + {"disassembly-flavor", &CMICmdCmdGdbShow::OptionFnDisassemblyFlavor}, {"fallback", &CMICmdCmdGdbShow::OptionFnFallback}}; //++ @@ -327,6 +329,26 @@ //++ //------------------------------------------------------------------------------------ +// 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. Index: tools/lldb-mi/MICmdCmdMiscellanous.cpp =================================================================== --- tools/lldb-mi/MICmdCmdMiscellanous.cpp +++ tools/lldb-mi/MICmdCmdMiscellanous.cpp @@ -496,14 +496,22 @@ //-- 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( Index: tools/lldb-mi/MICmdCmdTarget.cpp =================================================================== --- tools/lldb-mi/MICmdCmdTarget.cpp +++ tools/lldb-mi/MICmdCmdTarget.cpp @@ -123,6 +123,7 @@ // 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(), Index: tools/lldb-mi/MICmnMIOutOfBandRecord.h =================================================================== --- tools/lldb-mi/MICmnMIOutOfBandRecord.h +++ tools/lldb-mi/MICmnMIOutOfBandRecord.h @@ -66,6 +66,8 @@ eOutOfBand_TargetModuleLoaded, eOutOfBand_TargetModuleUnloaded, eOutOfBand_TargetStreamOutput + eOutOfBand_ConsoleStreamOutput, + eOutOfBand_LogStreamOutput }; // Methods: Index: tools/lldb-mi/MICmnMIOutOfBandRecord.cpp =================================================================== --- tools/lldb-mi/MICmnMIOutOfBandRecord.cpp +++ tools/lldb-mi/MICmnMIOutOfBandRecord.cpp @@ -48,6 +48,10 @@ 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 @@ return "="; case CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput: return "@"; + case CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput: + return "~"; + case CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput: + return "&"; } assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e"); return NULL;