[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.

llvm-svn: 355709
This commit is contained in:
Jonas Devlieghere
2019-03-08 17:50:27 +00:00
parent fee5576f7c
commit 84e571ce75
2 changed files with 14 additions and 3 deletions

View File

@@ -185,6 +185,14 @@ template <typename... Ts> inline std::string log_args(const Ts &... ts) {
#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 {

View File

@@ -108,6 +108,9 @@ SBFileSpec SBHostOS::GetUserHomeDirectory() {
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 *name) {
}
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_t thread, SBError *error_ptr) {
}
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_t thread, SBError *error_ptr) {
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);