Now -exec-continue command uses SB API to resume target's process.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | An error can claim to fail but not have an error string set. It might be nice to have a helper function that checks to make sure there is an error string on error cases and if there is no error string when error.Success() is false or error.Fail() is true, then set the error string to "unknown error". |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | This functionality might be useful in all lldb-mi commands. So do you know where to place this function? Maybe inside SBError class? |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | I would put it somewhere in lldb-mi in a static function that is something like: static void SetErrorString(lldb::SBError &error, T &lldbResult) { const char *error_cstr = error.GetCString(); if (error_cstr) lldbResult.SetError(error.GetCString()); else lldbResult.SetError("unknown error"); } Where the T is the type of m_lldbResult. |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | Actually, are we using m_lldbResult now? I didn't realize its type was lldb::SBCommandReturnObject. That was only needed if we were calling: rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(pCmd, m_lldbResult); So we can get rid of all "lldb::SBCommandReturnObject m_lldbResult" member variables in any lldb-mi functions where we switch to using the API. |
Also need to remove m_lldbResult from the CMICmdCmdExecContinue class.
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | Since we can get rid of m_lldbResult, this should be: } else return MIstatus::failure; |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | It should be: else { SetError(CMIUtilString::Format(..., error.GetCString())); return MIstatus::failure; } So, we anyway need a C-style error string. |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | AFAICT, SBError::GetCString calls Status::AsCString which has a default argument const char *default_error_str = "unknown error". So it sounds like this issue is already taken care of down below. If we are still getting null strings for failed SBErrors, maybe we need to fix something else instead of adding another layer here. |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | SBError::GetCString potentially may return NULL: const char *SBError::GetCString() const { if (m_opaque_ap.get()) return m_opaque_ap->AsCString(); return NULL; } |
tools/lldb-mi/MICmdCmdExec.cpp | ||
---|---|---|
248 ↗ | (On Diff #150391) | Yes, but that can happen only in case SBError::Fail() is false, which means you probably shouldn't be calling GetCString in the first place. |