[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sat Sep 14 14:10:27 PDT 2019
jankratochvil created this revision.
jankratochvil added reviewers: labath, JDevlieghere.
jankratochvil added a project: LLDB.
Herald added a subscriber: abidh.
I was writing an SB API client and it was crashing on:
bool DoExecute(SBDebugger dbg, char **command, SBCommandReturnObject &result) {
result = subcommand(dbg, "help");
That is because `SBCommandReturnObject &result` gets initialized inside LLDB by:
bool DoExecute(Args &command, CommandReturnObject &result) override {
// std::unique_ptr gets initialized here from `&result`!!!
SBCommandReturnObject sb_return(&result);
DoExecute(...);
sb_return.Release();
This is somehow a most simple fix. I do not like it much.
I think there could be two implementations for superclass `SBCommandReturnObject` for internal storage vs. external storage but that looked overcomplicated to me.
(Also sure there is missing a move-assignment operator.)
Repository:
rLLDB LLDB
https://reviews.llvm.org/D67589
Files:
lldb/include/lldb/API/SBCommandReturnObject.h
lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile
lldb/packages/Python/lldbsuite/test/api/command-return-object/TestSBCommandReturnObject.py
lldb/packages/Python/lldbsuite/test/api/command-return-object/main.cpp
lldb/scripts/Python/python-wrapper.swig
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/API/SBCommandReturnObject.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67589.220231.patch
Type: text/x-patch
Size: 9588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190914/e2c0c7b0/attachment.bin>
More information about the lldb-commits
mailing list