[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 19 14:15:07 PDT 2018
aprantl added a comment.
I think I misread your patch. Now the naming of success_handler makes much more sense, too.
What do you think about defining a function that takes an SBError result, and a function that converts this error into a string? This would allow chaining more than one SBAPI command in one lldb-mi command implementation. I'm not sure how common this is, though.
bool handleSBError(SBError error, std::function<std::string(SBError)> convert) {
if (error.Success())
return false;
SetError(convert(error));
return error_handler();
}
...
bool CMICmdCmdExecContinue::Execute() {
if (handleSBError(CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(), [](SBError error){
return CMIUtilString::Format(
MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
this->m_cmdData.strMiCmd.c_str(),
rErrMsg.c_str());'
})
return MIstatus::failure;
// potentially run other SBAPI commands...
return MIstatus::success;
};
https://reviews.llvm.org/D48295
More information about the lldb-commits
mailing list