[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 16 07:28:45 PDT 2019


clayborg added inline comments.


================
Comment at: lldb/source/API/SBCommandInterpreter.cpp:165-172
+    SBCommandReturnObject sb_return;
+    std::swap(result, SBCommandReturnObject_ref(sb_return));
     SBCommandInterpreter sb_interpreter(&m_interpreter);
     SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
     bool ret = m_backend->DoExecute(
         debugger_sb, (char **)command.GetArgumentVector(), sb_return);
+    std::swap(result, SBCommandReturnObject_ref(sb_return));
----------------
Could this code just create a local SBCommandReturnObject and then copy the CommandReturnObject back into "result"?

```
 bool DoExecute(Args &command, CommandReturnObject &result) override {
    SBCommandReturnObject sb_return;
    SBCommandInterpreter sb_interpreter(&m_interpreter);
    SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
    bool ret = m_backend->DoExecute(
        debugger_sb, (char **)command.GetArgumentVector(), sb_return);
    std::swap(result, sb_return.ref());
    return ret;
}
```


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67589/new/

https://reviews.llvm.org/D67589





More information about the lldb-commits mailing list