HomePhabricator

[lldb] Fix crash on SBCommandReturnObject & assignment

Description

[lldb] Fix crash on SBCommandReturnObject & assignment

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();

Differential revision: https://reviews.llvm.org/D67589

Details

Committed
jankratochvilOct 4 2019, 12:32 PM
Differential Revision
D67589: Fix crash on SBCommandReturnObject & assignment
Branches
Unknown
Tags
Unknown