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

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 16 02:01:49 PDT 2019


labath added a reviewer: jingham.
labath added a comment.

+ Jim for SB API.

I ran into this quirk of SBCommandReturnObject a couple of weeks ago, and then ran away screaming.

I agree that this approach isn't nice, but probably there isn't a nice approach to this at this point. One possibility you could consider is storing a shared_ptr<CommandRO> inside SBCommandRO and encoding the ownership into the deleter of the shared_ptr (regular deleter => owned, noop deleter => unowned).



================
Comment at: lldb/include/lldb/API/SBCommandReturnObject.h:24
+CommandReturnObject &
+SBCommandReturnObject_ref(lldb::SBCommandReturnObject &sb_cmd);
+}
----------------
Add a comment to explain the purpose of this function?


================
Comment at: lldb/packages/Python/lldbsuite/test/api/command-return-object/main.cpp:18
+    result = subcommand(dbg, "help");
+    result = result;
+    if (!result.Succeeded())
----------------
Is that intentional? If so, why?


================
Comment at: lldb/packages/Python/lldbsuite/test/api/command-return-object/main.cpp:23
+  }
+} crasher;
+
----------------
This looks weird. Please use a separate declaration for the variable and the class.


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