[Lldb-commits] [lldb] r355709 - [Reproducers] Add LLDB_RECORD_DUMMY

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 8 09:50:28 PST 2019


Author: jdevlieghere
Date: Fri Mar  8 09:50:27 2019
New Revision: 355709

URL: http://llvm.org/viewvc/llvm-project?rev=355709&view=rev
Log:
[Reproducers] Add LLDB_RECORD_DUMMY

Add a macro that doesn't actually record anything but still toggles the
API boundary. Removing just the register macros for lldb::thread_t
wasn't sufficient on NetBSD because the serialization logic needed the
underlying type to be complete.

This macro should be used by functions that are currently unsupported,
as they might trip the API boundary logic. This should be easy using the
lldb-instr tool.

Modified:
    lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
    lldb/trunk/source/API/SBHostOS.cpp

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=355709&r1=355708&r2=355709&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Fri Mar  8 09:50:27 2019
@@ -185,6 +185,14 @@ template <typename... Ts> inline std::st
 #define LLDB_RECORD_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
+/// technical reasons.
+#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...)               \
+  LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "{0} ({1})",             \
+           LLVM_PRETTY_FUNCTION, log_args(__VA_ARGS__));                       \
+  llvm::Optional<lldb_private::repro::Recorder> sb_recorder;
+
 namespace lldb_private {
 namespace repro {
 

Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=355709&r1=355708&r2=355709&view=diff
==============================================================================
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Fri Mar  8 09:50:27 2019
@@ -108,6 +108,9 @@ SBFileSpec SBHostOS::GetUserHomeDirector
 lldb::thread_t SBHostOS::ThreadCreate(const char *name,
                                       lldb::thread_func_t thread_function,
                                       void *thread_arg, SBError *error_ptr) {
+  LLDB_RECORD_DUMMY(lldb::thread_t, SBHostOS, ThreadCreate,
+                    (lldb::thread_func_t, void *, SBError *), name,
+                    thread_function, thread_arg, error_ptr);
   HostThread thread(ThreadLauncher::LaunchThread(
       name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL));
   return thread.Release();
@@ -119,7 +122,7 @@ void SBHostOS::ThreadCreated(const char
 }
 
 bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(bool, SBHostOS, ThreadCancel,
+  LLDB_RECORD_DUMMY(bool, SBHostOS, ThreadCancel,
                             (lldb::thread_t, lldb::SBError *), thread,
                             error_ptr);
 
@@ -133,7 +136,7 @@ bool SBHostOS::ThreadCancel(lldb::thread
 }
 
 bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(bool, SBHostOS, ThreadDetach,
+  LLDB_RECORD_DUMMY(bool, SBHostOS, ThreadDetach,
                             (lldb::thread_t, lldb::SBError *), thread,
                             error_ptr);
 
@@ -153,7 +156,7 @@ bool SBHostOS::ThreadDetach(lldb::thread
 
 bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
                           SBError *error_ptr) {
-  LLDB_RECORD_STATIC_METHOD(
+  LLDB_RECORD_DUMMY(
       bool, SBHostOS, ThreadJoin,
       (lldb::thread_t, lldb::thread_result_t *, lldb::SBError *), thread,
       result, error_ptr);




More information about the lldb-commits mailing list