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
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits