[Lldb-commits] [PATCH] D47992: [lldb-mi] Clean up and update a few MI commands.

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 21 11:35:02 PDT 2018


apolyakov updated this revision to Diff 152351.
apolyakov retitled this revision from "[lldb-mi] Correct error processing in exec-next command." to "[lldb-mi] Clean up and update a few MI commands.".
apolyakov edited the summary of this revision.
apolyakov added a comment.

I didn't committed patch https://reviews.llvm.org/D48295 yet, so I think if we change `HandleSBError` handlers from
`std::function<bool/void()>` to `std::function<bool/boid(CMICmdBase *)>` we'll be able to create anonymous namespace and declare there a function that takes a pointer to current command class(`this` pointer) instead if defining

  auto successHandler = [this] {
      // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
      if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) {
        const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
        this->SetError(CMIUtilString::Format(
            MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
            this->m_cmdData.strMiCmd.c_str(),
            rErrMsg.c_str()));
        return MIstatus::failure;
      }
      return MIstatus::success;

3 times in one file. It will reduce duplicating of code but I still think, is it worth it?


https://reviews.llvm.org/D47992

Files:
  tools/lldb-mi/MICmdCmdExec.cpp
  tools/lldb-mi/MICmdCmdExec.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47992.152351.patch
Type: text/x-patch
Size: 6534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180621/9d185f68/attachment.bin>


More information about the lldb-commits mailing list