diff options
| author | Alexander Polyakov <polyakov.alx@gmail.com> | 2018-06-10 14:58:29 +0000 |
|---|---|---|
| committer | Alexander Polyakov <polyakov.alx@gmail.com> | 2018-06-10 14:58:29 +0000 |
| commit | 4a60320a200848ff35c2d5d349a41f2f7706d4db (patch) | |
| tree | 5b2d7b9be8f55404795381c1065d3b751b547e2e /lldb/tools | |
| parent | 1db004ebddd5aea984c4488b3f73ad4efadce164 (diff) | |
| download | bcm5719-llvm-4a60320a200848ff35c2d5d349a41f2f7706d4db.tar.gz bcm5719-llvm-4a60320a200848ff35c2d5d349a41f2f7706d4db.zip | |
[lldb-mi] Re-implement MI -exec-step command.
Summary: Now -exec-step uses SB API instead of HandleCommand hack.
Reviewers: aprantl, clayborg, labath, stella.stamenova
Reviewed By: aprantl
Subscribers: ki.stfu, lldb-commits
Differential Revision: https://reviews.llvm.org/D47838
llvm-svn: 334364
Diffstat (limited to 'lldb/tools')
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdExec.cpp | 43 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdExec.h | 1 |
2 files changed, 21 insertions, 23 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdExec.cpp b/lldb/tools/lldb-mi/MICmdCmdExec.cpp index 784307c4e72..229e05c0915 100644 --- a/lldb/tools/lldb-mi/MICmdCmdExec.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdExec.cpp @@ -487,14 +487,26 @@ bool CMICmdCmdExecStep::Execute() { CMICmnLLDBDebugSessionInfo &rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance()); - lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger(); - CMIUtilString strCmd("thread step-in"); - if (nThreadId != UINT64_MAX) - strCmd += CMIUtilString::Format(" %llu", nThreadId); - rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, - false); - return MIstatus::success; + lldb::SBError error; + if (nThreadId != UINT64_MAX) { + lldb::SBThread sbThread = + rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId); + if (!sbThread.IsValid()) { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID), + m_cmdData.strMiCmd.c_str(), + m_constStrArgThread.c_str())); + return MIstatus::failure; + } + sbThread.StepInto(nullptr, LLDB_INVALID_LINE_NUMBER, error); + } else rSessionInfo.GetProcess().GetSelectedThread().StepInto( + nullptr, LLDB_INVALID_LINE_NUMBER, error); + + if (error.Success()) + return MIstatus::success; + + SetError(error.GetCString()); + return MIstatus::failure; } //++ @@ -509,21 +521,8 @@ bool CMICmdCmdExecStep::Execute() { // Throws: None. //-- bool CMICmdCmdExecStep::Acknowledge() { - if (m_lldbResult.GetErrorSize() > 0) { - const char *pLldbErr = m_lldbResult.GetError(); - MIunused(pLldbErr); - const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); - const CMICmnMIValueResult miValueResult("message", miValueConst); - const CMICmnMIResultRecord miRecordResult( - m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, - miValueResult); - m_miResultRecord = miRecordResult; - } else { - const CMICmnMIResultRecord miRecordResult( - m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); - m_miResultRecord = miRecordResult; - } - + m_miResultRecord = CMICmnMIResultRecord( + m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); return MIstatus::success; } diff --git a/lldb/tools/lldb-mi/MICmdCmdExec.h b/lldb/tools/lldb-mi/MICmdCmdExec.h index 75e511ed29b..810ca64724e 100644 --- a/lldb/tools/lldb-mi/MICmdCmdExec.h +++ b/lldb/tools/lldb-mi/MICmdCmdExec.h @@ -152,7 +152,6 @@ public: // Attributes: private: - lldb::SBCommandReturnObject m_lldbResult; const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but // Eclipse gives this option }; |

