[Lldb-commits] [lldb] r357639 - [Reproducers] Capture return values of functions returning by ptr/ref

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 3 14:31:22 PDT 2019


Author: jdevlieghere
Date: Wed Apr  3 14:31:22 2019
New Revision: 357639

URL: http://llvm.org/viewvc/llvm-project?rev=357639&view=rev
Log:
[Reproducers] Capture return values of functions returning by ptr/ref

For some reason I had convinced myself that functions returning by
pointer or reference do not require recording their result. However,
after further considering I don't see how that could work, at least not
with the current implementation. Interestingly enough, the reproducer
instrumentation already (mostly) accounts for this, though the
lldb-instr tool did not.

This patch adds the missing macros and updates the lldb-instr tool.

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

Modified:
    lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
    lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
    lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
    lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
    lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/API/SBAttachInfo.cpp
    lldb/trunk/source/API/SBBlock.cpp
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBBreakpointName.cpp
    lldb/trunk/source/API/SBBroadcaster.cpp
    lldb/trunk/source/API/SBCommandInterpreter.cpp
    lldb/trunk/source/API/SBCommandReturnObject.cpp
    lldb/trunk/source/API/SBCompileUnit.cpp
    lldb/trunk/source/API/SBData.cpp
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBDeclaration.cpp
    lldb/trunk/source/API/SBError.cpp
    lldb/trunk/source/API/SBEvent.cpp
    lldb/trunk/source/API/SBExecutionContext.cpp
    lldb/trunk/source/API/SBExpressionOptions.cpp
    lldb/trunk/source/API/SBFileSpec.cpp
    lldb/trunk/source/API/SBFileSpecList.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBFunction.cpp
    lldb/trunk/source/API/SBInstruction.cpp
    lldb/trunk/source/API/SBInstructionList.cpp
    lldb/trunk/source/API/SBLineEntry.cpp
    lldb/trunk/source/API/SBListener.cpp
    lldb/trunk/source/API/SBMemoryRegionInfo.cpp
    lldb/trunk/source/API/SBMemoryRegionInfoList.cpp
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBModuleSpec.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/API/SBProcessInfo.cpp
    lldb/trunk/source/API/SBQueue.cpp
    lldb/trunk/source/API/SBSection.cpp
    lldb/trunk/source/API/SBSourceManager.cpp
    lldb/trunk/source/API/SBStringList.cpp
    lldb/trunk/source/API/SBStructuredData.cpp
    lldb/trunk/source/API/SBSymbol.cpp
    lldb/trunk/source/API/SBSymbolContext.cpp
    lldb/trunk/source/API/SBSymbolContextList.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/API/SBThreadCollection.cpp
    lldb/trunk/source/API/SBThreadPlan.cpp
    lldb/trunk/source/API/SBType.cpp
    lldb/trunk/source/API/SBTypeCategory.cpp
    lldb/trunk/source/API/SBTypeEnumMember.cpp
    lldb/trunk/source/API/SBTypeFilter.cpp
    lldb/trunk/source/API/SBTypeFormat.cpp
    lldb/trunk/source/API/SBTypeNameSpecifier.cpp
    lldb/trunk/source/API/SBTypeSummary.cpp
    lldb/trunk/source/API/SBTypeSynthetic.cpp
    lldb/trunk/source/API/SBUnixSignals.cpp
    lldb/trunk/source/API/SBValue.cpp
    lldb/trunk/source/API/SBValueList.cpp
    lldb/trunk/source/API/SBVariablesOptions.cpp
    lldb/trunk/source/API/SBWatchpoint.cpp
    lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
    lldb/trunk/tools/lldb-instr/Instrument.cpp
    lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Wed Apr  3 14:31:22 2019
@@ -185,7 +185,7 @@ template <typename... Ts> inline std::st
   }
 
 #define LLDB_RECORD_RESULT(Result)                                             \
-  sb_recorder ? sb_recorder->RecordResult(Result) : Result;
+  sb_recorder ? sb_recorder->RecordResult(Result) : (Result);
 
 /// The LLDB_RECORD_DUMMY macro is special because it doesn't actually record
 /// anything. It's used to track API boundaries when we cannot record for
@@ -643,13 +643,7 @@ public:
       return;
 
     unsigned id = m_registry.GetID(uintptr_t(f));
-
-#ifndef LLDB_REPRO_INSTR_TRACE
-    LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "Recording {0}: {1}",
-             id, m_pretty_func);
-#else
-    llvm::errs() << "Recording " << id << ": " << m_pretty_func << "\n";
-#endif
+    Log(id);
 
     m_serializer.SerializeAll(id);
     m_serializer.SerializeAll(args...);
@@ -670,13 +664,7 @@ public:
       return;
 
     unsigned id = m_registry.GetID(uintptr_t(f));
-
-#ifndef LLDB_REPRO_INSTR_TRACE
-    LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "Recording {0}: {1}",
-             id, m_pretty_func);
-#else
-    llvm::errs() << "Recording " << id << ": " << m_pretty_func << "\n";
-#endif
+    Log(id);
 
     m_serializer.SerializeAll(id);
     m_serializer.SerializeAll(args...);
@@ -687,14 +675,14 @@ public:
   }
 
   /// Record the result of a function call.
-  template <typename Result> Result RecordResult(const Result &r) {
+  template <typename Result> Result RecordResult(Result &&r) {
     UpdateBoundary();
     if (ShouldCapture()) {
       assert(!m_result_recorded);
       m_serializer.SerializeAll(r);
       m_result_recorded = true;
     }
-    return r;
+    return std::forward<Result>(r);
   }
 
 private:
@@ -704,6 +692,7 @@ private:
   }
 
   bool ShouldCapture() { return m_local_boundary; }
+  void Log(unsigned id);
 
   Serializer &m_serializer;
   Registry &m_registry;

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp Wed Apr  3 14:31:22 2019
@@ -16,3 +16,11 @@ Foo Foo::H() { return Foo(); }
 void Foo::I() const { MACRO_FOO; }
 Bar Foo::J() const { return MACRO_BAR(Bar()); }
 Bar Foo::K(void *v) const { return Bar(); }
+Bar &Foo::L() const {
+  Bar *b = new Bar();
+  return *b;
+};
+Bar *Foo::M() const {
+  Bar *b = new Bar();
+  return b;
+};

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h Wed Apr  3 14:31:22 2019
@@ -14,4 +14,6 @@ struct Foo {
   void I() const;
   Bar J() const;
   Bar K(void *v) const;
+  Bar &L() const;
+  Bar *M() const;
 };

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test Wed Apr  3 14:31:22 2019
@@ -20,3 +20,5 @@
 # CHECK-NOT: LLDB_RECORD_RESULT(Bar());
 # CHECK: LLDB_RECORD_DUMMY(Bar, Foo, K, (void *), v);
 # CHECK-NOT: LLDB_RECORD_RESULT(Bar());
+# CHECK: LLDB_RECORD_RESULT(*b)
+# CHECK: LLDB_RECORD_RESULT(b)

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test Wed Apr  3 14:31:22 2019
@@ -11,6 +11,9 @@
 # CHECK: LLDB_REGISTER_METHOD_CONST(int, Foo, D, (bool));
 # CHECK: LLDB_REGISTER_STATIC_METHOD(void, Foo, E, ());
 # CHECK: LLDB_REGISTER_STATIC_METHOD(int, Foo, F, (int));
+# CHECK: LLDB_REGISTER_METHOD_CONST(Bar, Foo, J, ());
+# CHECK: LLDB_REGISTER_METHOD_CONST(Bar &, Foo, L, ());
+# CHECK: LLDB_REGISTER_METHOD_CONST(Bar *, Foo, M, ());
 # CHECK-NOT: LLDB_REGISTER_STATIC_METHOD(void, Foo, G
 # CHECK-NOT: LLDB_REGISTER_METHOD_CONST(void, Foo, I, ());
 # CHECK-NOT: LLDB_REGISTER_METHOD_CONST(Bar, Foo, K, (void*));

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Wed Apr  3 14:31:22 2019
@@ -60,7 +60,7 @@ const SBAddress &SBAddress::operator=(co
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool lldb::operator==(const SBAddress &lhs, const SBAddress &rhs) {

Modified: lldb/trunk/source/API/SBAttachInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAttachInfo.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAttachInfo.cpp (original)
+++ lldb/trunk/source/API/SBAttachInfo.cpp Wed Apr  3 14:31:22 2019
@@ -64,7 +64,7 @@ SBAttachInfo &SBAttachInfo::operator=(co
 
   if (this != &rhs)
     m_opaque_sp = clone(rhs.m_opaque_sp);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 lldb::pid_t SBAttachInfo::GetProcessID() {

Modified: lldb/trunk/source/API/SBBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBlock.cpp (original)
+++ lldb/trunk/source/API/SBBlock.cpp Wed Apr  3 14:31:22 2019
@@ -41,7 +41,7 @@ const SBBlock &SBBlock::operator=(const
                      SBBlock, operator=,(const lldb::SBBlock &), rhs);
 
   m_opaque_ptr = rhs.m_opaque_ptr;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBBlock::~SBBlock() { m_opaque_ptr = NULL; }

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Wed Apr  3 14:31:22 2019
@@ -62,7 +62,7 @@ const SBBreakpoint &SBBreakpoint::operat
                      SBBreakpoint, operator=,(const lldb::SBBreakpoint &), rhs);
 
   m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Wed Apr  3 14:31:22 2019
@@ -54,7 +54,7 @@ operator=(const SBBreakpointLocation &rh
       rhs);
 
   m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBBreakpointLocation::~SBBreakpointLocation() {}

Modified: lldb/trunk/source/API/SBBreakpointName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointName.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointName.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointName.cpp Wed Apr  3 14:31:22 2019
@@ -166,12 +166,12 @@ operator=(const SBBreakpointName &rhs) {
 
   if (!rhs.m_impl_up) {
     m_impl_up.reset();
-    return *this;
+    return LLDB_RECORD_RESULT(*this);
   }
 
   m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(),
                                            rhs.m_impl_up->GetName()));
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) {

Modified: lldb/trunk/source/API/SBBroadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBroadcaster.cpp (original)
+++ lldb/trunk/source/API/SBBroadcaster.cpp Wed Apr  3 14:31:22 2019
@@ -45,7 +45,7 @@ const SBBroadcaster &SBBroadcaster::oper
     m_opaque_sp = rhs.m_opaque_sp;
     m_opaque_ptr = rhs.m_opaque_ptr;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBBroadcaster::~SBBroadcaster() { reset(NULL, false); }

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Wed Apr  3 14:31:22 2019
@@ -196,7 +196,7 @@ operator=(const SBCommandInterpreter &rh
       rhs);
 
   m_opaque_ptr = rhs.m_opaque_ptr;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBCommandInterpreter::IsValid() const {

Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Wed Apr  3 14:31:22 2019
@@ -43,7 +43,7 @@ CommandReturnObject *SBCommandReturnObje
   LLDB_RECORD_METHOD_NO_ARGS(lldb_private::CommandReturnObject *,
                              SBCommandReturnObject, Release);
 
-  return m_opaque_up.release();
+  return LLDB_RECORD_RESULT(m_opaque_up.release());
 }
 
 const SBCommandReturnObject &SBCommandReturnObject::
@@ -55,7 +55,7 @@ operator=(const SBCommandReturnObject &r
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBCommandReturnObject::IsValid() const {

Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Wed Apr  3 14:31:22 2019
@@ -38,7 +38,7 @@ const SBCompileUnit &SBCompileUnit::oper
                      rhs);
 
   m_opaque_ptr = rhs.m_opaque_ptr;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBCompileUnit::~SBCompileUnit() { m_opaque_ptr = NULL; }

Modified: lldb/trunk/source/API/SBData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBData.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBData.cpp (original)
+++ lldb/trunk/source/API/SBData.cpp Wed Apr  3 14:31:22 2019
@@ -38,7 +38,7 @@ const SBData &SBData::operator=(const SB
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBData::~SBData() {}

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Apr  3 14:31:22 2019
@@ -182,7 +182,7 @@ SBDebugger &SBDebugger::operator=(const
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBDebugger::Initialize() {
@@ -373,7 +373,7 @@ FILE *SBDebugger::GetInputFileHandle() {
   if (m_opaque_sp) {
     StreamFileSP stream_file_sp(m_opaque_sp->GetInputFile());
     if (stream_file_sp)
-      return stream_file_sp->GetFile().GetStream();
+      return LLDB_RECORD_RESULT(stream_file_sp->GetFile().GetStream());
   }
   return nullptr;
 }
@@ -384,7 +384,7 @@ FILE *SBDebugger::GetOutputFileHandle()
   if (m_opaque_sp) {
     StreamFileSP stream_file_sp(m_opaque_sp->GetOutputFile());
     if (stream_file_sp)
-      return stream_file_sp->GetFile().GetStream();
+      return LLDB_RECORD_RESULT(stream_file_sp->GetFile().GetStream());
   }
   return nullptr;
 }
@@ -395,7 +395,7 @@ FILE *SBDebugger::GetErrorFileHandle() {
   if (m_opaque_sp) {
     StreamFileSP stream_file_sp(m_opaque_sp->GetErrorFile());
     if (stream_file_sp)
-      return stream_file_sp->GetFile().GetStream();
+      return LLDB_RECORD_RESULT(stream_file_sp->GetFile().GetStream());
   }
   return nullptr;
 }

Modified: lldb/trunk/source/API/SBDeclaration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDeclaration.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDeclaration.cpp (original)
+++ lldb/trunk/source/API/SBDeclaration.cpp Wed Apr  3 14:31:22 2019
@@ -42,7 +42,7 @@ const SBDeclaration &SBDeclaration::oper
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBDeclaration::SetDeclaration(

Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Wed Apr  3 14:31:22 2019
@@ -33,7 +33,7 @@ const SBError &SBError::operator=(const
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 const char *SBError::GetCString() const {

Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Wed Apr  3 14:31:22 2019
@@ -55,7 +55,7 @@ const SBEvent &SBEvent::operator=(const
     m_event_sp = rhs.m_event_sp;
     m_opaque_ptr = rhs.m_opaque_ptr;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBEvent::~SBEvent() {}

Modified: lldb/trunk/source/API/SBExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBExecutionContext.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBExecutionContext.cpp (original)
+++ lldb/trunk/source/API/SBExecutionContext.cpp Wed Apr  3 14:31:22 2019
@@ -75,7 +75,7 @@ operator=(const lldb::SBExecutionContext
       SBExecutionContext, operator=,(const lldb::SBExecutionContext &), rhs);
 
   m_exe_ctx_sp = rhs.m_exe_ctx_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 ExecutionContextRef *SBExecutionContext::get() const {

Modified: lldb/trunk/source/API/SBExpressionOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBExpressionOptions.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBExpressionOptions.cpp (original)
+++ lldb/trunk/source/API/SBExpressionOptions.cpp Wed Apr  3 14:31:22 2019
@@ -37,7 +37,7 @@ operator=(const SBExpressionOptions &rhs
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBExpressionOptions::~SBExpressionOptions() {}

Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Wed Apr  3 14:31:22 2019
@@ -59,7 +59,7 @@ const SBFileSpec &SBFileSpec::operator=(
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBFileSpec::operator==(const SBFileSpec &rhs) const {

Modified: lldb/trunk/source/API/SBFileSpecList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpecList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpecList.cpp (original)
+++ lldb/trunk/source/API/SBFileSpecList.cpp Wed Apr  3 14:31:22 2019
@@ -41,7 +41,7 @@ const SBFileSpecList &SBFileSpecList::op
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 uint32_t SBFileSpecList::GetSize() const {

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Apr  3 14:31:22 2019
@@ -78,7 +78,7 @@ const SBFrame &SBFrame::operator=(const
 
   if (this != &rhs)
     m_opaque_sp = clone(rhs.m_opaque_sp);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 StackFrameSP SBFrame::GetFrameSP() const {

Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Wed Apr  3 14:31:22 2019
@@ -39,7 +39,7 @@ const SBFunction &SBFunction::operator=(
                      SBFunction, operator=,(const lldb::SBFunction &), rhs);
 
   m_opaque_ptr = rhs.m_opaque_ptr;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBFunction::~SBFunction() { m_opaque_ptr = NULL; }

Modified: lldb/trunk/source/API/SBInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInstruction.cpp (original)
+++ lldb/trunk/source/API/SBInstruction.cpp Wed Apr  3 14:31:22 2019
@@ -87,7 +87,7 @@ const SBInstruction &SBInstruction::oper
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBInstruction::~SBInstruction() {}

Modified: lldb/trunk/source/API/SBInstructionList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstructionList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInstructionList.cpp (original)
+++ lldb/trunk/source/API/SBInstructionList.cpp Wed Apr  3 14:31:22 2019
@@ -37,7 +37,7 @@ operator=(const SBInstructionList &rhs)
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBInstructionList::~SBInstructionList() {}

Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Wed Apr  3 14:31:22 2019
@@ -41,7 +41,7 @@ const SBLineEntry &SBLineEntry::operator
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBLineEntry::SetLineEntry(const lldb_private::LineEntry &lldb_object_ref) {

Modified: lldb/trunk/source/API/SBListener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBListener.cpp (original)
+++ lldb/trunk/source/API/SBListener.cpp Wed Apr  3 14:31:22 2019
@@ -42,7 +42,7 @@ const lldb::SBListener &SBListener::oper
     m_opaque_sp = rhs.m_opaque_sp;
     m_unused_ptr = nullptr;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBListener::SBListener(const lldb::ListenerSP &listener_sp)

Modified: lldb/trunk/source/API/SBMemoryRegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBMemoryRegionInfo.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBMemoryRegionInfo.cpp (original)
+++ lldb/trunk/source/API/SBMemoryRegionInfo.cpp Wed Apr  3 14:31:22 2019
@@ -43,7 +43,7 @@ operator=(const SBMemoryRegionInfo &rhs)
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBMemoryRegionInfo::~SBMemoryRegionInfo() {}

Modified: lldb/trunk/source/API/SBMemoryRegionInfoList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBMemoryRegionInfoList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBMemoryRegionInfoList.cpp (original)
+++ lldb/trunk/source/API/SBMemoryRegionInfoList.cpp Wed Apr  3 14:31:22 2019
@@ -94,7 +94,7 @@ operator=(const SBMemoryRegionInfoList &
   if (this != &rhs) {
     *m_opaque_up = *rhs.m_opaque_up;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 uint32_t SBMemoryRegionInfoList::GetSize() const {

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Wed Apr  3 14:31:22 2019
@@ -73,7 +73,7 @@ const SBModule &SBModule::operator=(cons
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBModule::~SBModule() {}

Modified: lldb/trunk/source/API/SBModuleSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModuleSpec.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModuleSpec.cpp (original)
+++ lldb/trunk/source/API/SBModuleSpec.cpp Wed Apr  3 14:31:22 2019
@@ -35,7 +35,7 @@ const SBModuleSpec &SBModuleSpec::operat
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBModuleSpec::~SBModuleSpec() {}
@@ -166,7 +166,7 @@ SBModuleSpecList &SBModuleSpecList::oper
 
   if (this != &rhs)
     *m_opaque_up = *rhs.m_opaque_up;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBModuleSpecList::~SBModuleSpecList() {}

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Wed Apr  3 14:31:22 2019
@@ -72,7 +72,7 @@ const SBProcess &SBProcess::operator=(co
 
   if (this != &rhs)
     m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/API/SBProcessInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcessInfo.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcessInfo.cpp (original)
+++ lldb/trunk/source/API/SBProcessInfo.cpp Wed Apr  3 14:31:22 2019
@@ -34,7 +34,7 @@ SBProcessInfo &SBProcessInfo::operator=(
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 ProcessInstanceInfo &SBProcessInfo::ref() {

Modified: lldb/trunk/source/API/SBQueue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBQueue.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBQueue.cpp (original)
+++ lldb/trunk/source/API/SBQueue.cpp Wed Apr  3 14:31:22 2019
@@ -240,7 +240,7 @@ const lldb::SBQueue &SBQueue::operator=(
                      SBQueue, operator=,(const lldb::SBQueue &), rhs);
 
   m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBQueue::~SBQueue() {}

Modified: lldb/trunk/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSection.cpp (original)
+++ lldb/trunk/source/API/SBSection.cpp Wed Apr  3 14:31:22 2019
@@ -41,7 +41,7 @@ const SBSection &SBSection::operator=(co
                      SBSection, operator=,(const lldb::SBSection &), rhs);
 
   m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBSection::~SBSection() {}

Modified: lldb/trunk/source/API/SBSourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSourceManager.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSourceManager.cpp (original)
+++ lldb/trunk/source/API/SBSourceManager.cpp Wed Apr  3 14:31:22 2019
@@ -101,7 +101,7 @@ operator=(const lldb::SBSourceManager &r
                      rhs);
 
   m_opaque_up.reset(new SourceManagerImpl(*(rhs.m_opaque_up.get())));
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBSourceManager::~SBSourceManager() {}

Modified: lldb/trunk/source/API/SBStringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStringList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBStringList.cpp (original)
+++ lldb/trunk/source/API/SBStringList.cpp Wed Apr  3 14:31:22 2019
@@ -36,7 +36,7 @@ const SBStringList &SBStringList::operat
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBStringList::~SBStringList() {}

Modified: lldb/trunk/source/API/SBStructuredData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStructuredData.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBStructuredData.cpp (original)
+++ lldb/trunk/source/API/SBStructuredData.cpp Wed Apr  3 14:31:22 2019
@@ -54,7 +54,7 @@ operator=(const lldb::SBStructuredData &
       SBStructuredData, operator=,(const lldb::SBStructuredData &), rhs);
 
   *m_impl_up = *rhs.m_impl_up;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 lldb::SBError SBStructuredData::SetFromJSON(lldb::SBStream &stream) {

Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Wed Apr  3 14:31:22 2019
@@ -34,7 +34,7 @@ const SBSymbol &SBSymbol::operator=(cons
                      SBSymbol, operator=,(const lldb::SBSymbol &), rhs);
 
   m_opaque_ptr = rhs.m_opaque_ptr;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBSymbol::~SBSymbol() { m_opaque_ptr = NULL; }

Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Wed Apr  3 14:31:22 2019
@@ -46,7 +46,7 @@ const SBSymbolContext &SBSymbolContext::
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBSymbolContext::SetSymbolContext(const SymbolContext *sc_ptr) {

Modified: lldb/trunk/source/API/SBSymbolContextList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContextList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContextList.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContextList.cpp Wed Apr  3 14:31:22 2019
@@ -38,7 +38,7 @@ operator=(const SBSymbolContextList &rhs
 
   if (this != &rhs)
     m_opaque_up = clone(rhs.m_opaque_up);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 uint32_t SBSymbolContextList::GetSize() const {

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Apr  3 14:31:22 2019
@@ -118,7 +118,7 @@ const SBTarget &SBTarget::operator=(cons
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Wed Apr  3 14:31:22 2019
@@ -84,7 +84,7 @@ const lldb::SBThread &SBThread::operator
 
   if (this != &rhs)
     m_opaque_sp = clone(rhs.m_opaque_sp);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 //----------------------------------------------------------------------
@@ -1402,9 +1402,8 @@ lldb_private::Thread *SBThread::operator
 
   ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
   if (thread_sp)
-    return thread_sp.get();
-  else
-    return NULL;
+    return LLDB_RECORD_RESULT(thread_sp.get());
+  return nullptr;
 }
 
 lldb_private::Thread *SBThread::get() {
@@ -1412,9 +1411,8 @@ lldb_private::Thread *SBThread::get() {
 
   ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
   if (thread_sp)
-    return thread_sp.get();
-  else
-    return NULL;
+    return LLDB_RECORD_RESULT(thread_sp.get());
+  return nullptr;
 }
 
 namespace lldb_private {

Modified: lldb/trunk/source/API/SBThreadCollection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThreadCollection.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThreadCollection.cpp (original)
+++ lldb/trunk/source/API/SBThreadCollection.cpp Wed Apr  3 14:31:22 2019
@@ -32,7 +32,7 @@ operator=(const SBThreadCollection &rhs)
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)

Modified: lldb/trunk/source/API/SBThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThreadPlan.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThreadPlan.cpp (original)
+++ lldb/trunk/source/API/SBThreadPlan.cpp Wed Apr  3 14:31:22 2019
@@ -82,7 +82,7 @@ const lldb::SBThreadPlan &SBThreadPlan::
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 //----------------------------------------------------------------------
 // Destructor
@@ -92,7 +92,7 @@ SBThreadPlan::~SBThreadPlan() {}
 lldb_private::ThreadPlan *SBThreadPlan::get() {
   LLDB_RECORD_METHOD_NO_ARGS(lldb_private::ThreadPlan *, SBThreadPlan, get);
 
-  return m_opaque_sp.get();
+  return LLDB_RECORD_RESULT(m_opaque_sp.get());
 }
 
 bool SBThreadPlan::IsValid() const {

Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Wed Apr  3 14:31:22 2019
@@ -86,7 +86,7 @@ SBType &SBType::operator=(const SBType &
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBType::~SBType() {}
@@ -592,7 +592,7 @@ SBTypeList &SBTypeList::operator=(const
          i < rhs_size; i++)
       Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBTypeList::Append(SBType type) {
@@ -642,7 +642,7 @@ lldb::SBTypeMember &SBTypeMember::operat
     if (rhs.IsValid())
       m_opaque_up.reset(new TypeMemberImpl(rhs.ref()));
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeMember::IsValid() const {
@@ -771,7 +771,7 @@ operator=(const lldb::SBTypeMemberFuncti
 
   if (this != &rhs)
     m_opaque_sp = rhs.m_opaque_sp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeMemberFunction::IsValid() const {

Modified: lldb/trunk/source/API/SBTypeCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeCategory.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeCategory.cpp (original)
+++ lldb/trunk/source/API/SBTypeCategory.cpp Wed Apr  3 14:31:22 2019
@@ -616,7 +616,7 @@ operator=(const lldb::SBTypeCategory &rh
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeCategory::operator==(lldb::SBTypeCategory &rhs) {

Modified: lldb/trunk/source/API/SBTypeEnumMember.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeEnumMember.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeEnumMember.cpp (original)
+++ lldb/trunk/source/API/SBTypeEnumMember.cpp Wed Apr  3 14:31:22 2019
@@ -40,12 +40,13 @@ SBTypeEnumMember::SBTypeEnumMember(const
 }
 
 SBTypeEnumMember &SBTypeEnumMember::operator=(const SBTypeEnumMember &rhs) {
-  LLDB_RECORD_CONSTRUCTOR(SBTypeEnumMember, (const lldb::SBTypeEnumMember &),
-                          rhs);
+  LLDB_RECORD_METHOD(
+      SBTypeEnumMember &,
+      SBTypeEnumMember, operator=,(const lldb::SBTypeEnumMember &), rhs);
 
   if (this != &rhs)
     m_opaque_sp = clone(rhs.m_opaque_sp);
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeEnumMember::IsValid() const {
@@ -147,7 +148,7 @@ operator=(const SBTypeEnumMemberList &rh
       Append(
           const_cast<SBTypeEnumMemberList &>(rhs).GetTypeEnumMemberAtIndex(i));
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 void SBTypeEnumMemberList::Append(SBTypeEnumMember enum_member) {

Modified: lldb/trunk/source/API/SBTypeFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeFilter.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeFilter.cpp (original)
+++ lldb/trunk/source/API/SBTypeFilter.cpp Wed Apr  3 14:31:22 2019
@@ -126,7 +126,7 @@ lldb::SBTypeFilter &SBTypeFilter::operat
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeFilter::operator==(lldb::SBTypeFilter &rhs) {

Modified: lldb/trunk/source/API/SBTypeFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeFormat.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeFormat.cpp (original)
+++ lldb/trunk/source/API/SBTypeFormat.cpp Wed Apr  3 14:31:22 2019
@@ -121,7 +121,7 @@ lldb::SBTypeFormat &SBTypeFormat::operat
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeFormat::operator==(lldb::SBTypeFormat &rhs) {

Modified: lldb/trunk/source/API/SBTypeNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeNameSpecifier.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeNameSpecifier.cpp (original)
+++ lldb/trunk/source/API/SBTypeNameSpecifier.cpp Wed Apr  3 14:31:22 2019
@@ -108,7 +108,7 @@ operator=(const lldb::SBTypeNameSpecifie
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeNameSpecifier::operator==(lldb::SBTypeNameSpecifier &rhs) {

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Wed Apr  3 14:31:22 2019
@@ -345,7 +345,7 @@ lldb::SBTypeSummary &SBTypeSummary::oper
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeSummary::operator==(lldb::SBTypeSummary &rhs) {

Modified: lldb/trunk/source/API/SBTypeSynthetic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSynthetic.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeSynthetic.cpp (original)
+++ lldb/trunk/source/API/SBTypeSynthetic.cpp Wed Apr  3 14:31:22 2019
@@ -143,7 +143,7 @@ operator=(const lldb::SBTypeSynthetic &r
   if (this != &rhs) {
     m_opaque_sp = rhs.m_opaque_sp;
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 bool SBTypeSynthetic::operator==(lldb::SBTypeSynthetic &rhs) {

Modified: lldb/trunk/source/API/SBUnixSignals.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBUnixSignals.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBUnixSignals.cpp (original)
+++ lldb/trunk/source/API/SBUnixSignals.cpp Wed Apr  3 14:31:22 2019
@@ -40,7 +40,7 @@ const SBUnixSignals &SBUnixSignals::oper
 
   if (this != &rhs)
     m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBUnixSignals::~SBUnixSignals() {}

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Apr  3 14:31:22 2019
@@ -236,7 +236,7 @@ SBValue &SBValue::operator=(const SBValu
   if (this != &rhs) {
     SetSP(rhs.m_opaque_sp);
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBValue::~SBValue() {}

Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Wed Apr  3 14:31:22 2019
@@ -111,7 +111,7 @@ const SBValueList &SBValueList::operator
     else
       m_opaque_up.reset();
   }
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 ValueListImpl *SBValueList::operator->() { return m_opaque_up.get(); }

Modified: lldb/trunk/source/API/SBVariablesOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBVariablesOptions.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBVariablesOptions.cpp (original)
+++ lldb/trunk/source/API/SBVariablesOptions.cpp Wed Apr  3 14:31:22 2019
@@ -99,7 +99,7 @@ operator=(const SBVariablesOptions &opti
       options);
 
   m_opaque_up.reset(new VariablesOptionsImpl(options.ref()));
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBVariablesOptions::~SBVariablesOptions() = default;

Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Wed Apr  3 14:31:22 2019
@@ -43,7 +43,7 @@ const SBWatchpoint &SBWatchpoint::operat
                      SBWatchpoint, operator=,(const lldb::SBWatchpoint &), rhs);
 
   m_opaque_wp = rhs.m_opaque_wp;
-  return *this;
+  return LLDB_RECORD_RESULT(*this);
 }
 
 SBWatchpoint::~SBWatchpoint() {}

Modified: lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ReproducerInstrumentation.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ReproducerInstrumentation.cpp (original)
+++ lldb/trunk/source/Utility/ReproducerInstrumentation.cpp Wed Apr  3 14:31:22 2019
@@ -117,4 +117,13 @@ Recorder::~Recorder() {
   UpdateBoundary();
 }
 
+void Recorder::Log(unsigned id) {
+#ifndef LLDB_REPRO_INSTR_TRACE
+  LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "Recording {0}: {1}", id,
+           m_pretty_func);
+#else
+  llvm::errs() << "Recording " << id << ": " << m_pretty_func << "\n";
+#endif
+}
+
 bool lldb_private::repro::Recorder::g_global_boundary;

Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-instr/Instrument.cpp (original)
+++ lldb/trunk/tools/lldb-instr/Instrument.cpp Wed Apr  3 14:31:22 2019
@@ -245,7 +245,9 @@ public:
 
     // If the function returns a class or struct, we need to wrap its return
     // statement(s).
-    if (!ShouldInsertDummy && ReturnType->isStructureOrClassType()) {
+    bool ShouldRecordResult = ReturnType->isStructureOrClassType() ||
+                              ReturnType->getPointeeCXXRecordDecl();
+    if (!ShouldInsertDummy && ShouldRecordResult) {
       SBReturnVisitor Visitor(MyRewriter);
       Visitor.TraverseDecl(Decl);
     }

Modified: lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp?rev=357639&r1=357638&r2=357639&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp Wed Apr  3 14:31:22 2019
@@ -89,6 +89,8 @@ public:
   /// {
   InstrumentedBar();
   InstrumentedFoo GetInstrumentedFoo();
+  InstrumentedFoo &GetInstrumentedFooRef();
+  InstrumentedFoo *GetInstrumentedFooPtr();
   void SetInstrumentedFoo(InstrumentedFoo *foo);
   void SetInstrumentedFoo(InstrumentedFoo &foo);
   void Validate();
@@ -201,6 +203,22 @@ InstrumentedFoo InstrumentedBar::GetInst
   return LLDB_RECORD_RESULT(InstrumentedFoo(0));
 }
 
+InstrumentedFoo &InstrumentedBar::GetInstrumentedFooRef() {
+  LLDB_RECORD_METHOD_NO_ARGS(InstrumentedFoo &, InstrumentedBar,
+                             GetInstrumentedFooRef);
+  InstrumentedFoo *foo = new InstrumentedFoo(0);
+  m_get_instrumend_foo_called = true;
+  return LLDB_RECORD_RESULT(*foo);
+}
+
+InstrumentedFoo *InstrumentedBar::GetInstrumentedFooPtr() {
+  LLDB_RECORD_METHOD_NO_ARGS(InstrumentedFoo *, InstrumentedBar,
+                             GetInstrumentedFooPtr);
+  InstrumentedFoo *foo = new InstrumentedFoo(0);
+  m_get_instrumend_foo_called = true;
+  return LLDB_RECORD_RESULT(foo);
+}
+
 void InstrumentedBar::SetInstrumentedFoo(InstrumentedFoo *foo) {
   LLDB_RECORD_METHOD(void, InstrumentedBar, SetInstrumentedFoo,
                      (InstrumentedFoo *), foo);
@@ -239,6 +257,10 @@ TestingRegistry::TestingRegistry() {
   LLDB_REGISTER_CONSTRUCTOR(InstrumentedBar, ());
   LLDB_REGISTER_METHOD(InstrumentedFoo, InstrumentedBar, GetInstrumentedFoo,
                        ());
+  LLDB_REGISTER_METHOD(InstrumentedFoo &, InstrumentedBar,
+                       GetInstrumentedFooRef, ());
+  LLDB_REGISTER_METHOD(InstrumentedFoo *, InstrumentedBar,
+                       GetInstrumentedFooPtr, ());
   LLDB_REGISTER_METHOD(void, InstrumentedBar, SetInstrumentedFoo,
                        (InstrumentedFoo *));
   LLDB_REGISTER_METHOD(void, InstrumentedBar, SetInstrumentedFoo,
@@ -487,6 +509,80 @@ TEST(RecordReplayTest, InstrumentedBar)
   {
     InstrumentedBar bar;
     InstrumentedFoo foo = bar.GetInstrumentedFoo();
+#if 0
+    InstrumentedFoo& foo_ref = bar.GetInstrumentedFooRef();
+    InstrumentedFoo* foo_ptr = bar.GetInstrumentedFooPtr();
+#endif
+
+    int b = 200;
+    float c = 300.3;
+    double e = 400.4;
+
+    foo.A(100);
+    foo.B(b);
+    foo.C(&c);
+    foo.D("bar");
+    InstrumentedFoo::E(e);
+    InstrumentedFoo::F();
+    foo.Validate();
+
+    bar.SetInstrumentedFoo(foo);
+    bar.SetInstrumentedFoo(&foo);
+    bar.Validate();
+  }
+
+  ClearObjects();
+
+  TestingRegistry registry;
+  registry.Replay(os.str());
+
+  ValidateObjects(1, 1);
+}
+
+TEST(RecordReplayTest, InstrumentedBarRef) {
+  std::string str;
+  llvm::raw_string_ostream os(str);
+  g_registry.emplace();
+  g_serializer.emplace(os);
+
+  {
+    InstrumentedBar bar;
+    InstrumentedFoo &foo = bar.GetInstrumentedFooRef();
+
+    int b = 200;
+    float c = 300.3;
+    double e = 400.4;
+
+    foo.A(100);
+    foo.B(b);
+    foo.C(&c);
+    foo.D("bar");
+    InstrumentedFoo::E(e);
+    InstrumentedFoo::F();
+    foo.Validate();
+
+    bar.SetInstrumentedFoo(foo);
+    bar.SetInstrumentedFoo(&foo);
+    bar.Validate();
+  }
+
+  ClearObjects();
+
+  TestingRegistry registry;
+  registry.Replay(os.str());
+
+  ValidateObjects(1, 1);
+}
+
+TEST(RecordReplayTest, InstrumentedBarPtr) {
+  std::string str;
+  llvm::raw_string_ostream os(str);
+  g_registry.emplace();
+  g_serializer.emplace(os);
+
+  {
+    InstrumentedBar bar;
+    InstrumentedFoo &foo = *(bar.GetInstrumentedFooPtr());
 
     int b = 200;
     float c = 300.3;




More information about the lldb-commits mailing list