Author: Jonas Devlieghere Date: 2020-05-20T10:37:18-07:00 New Revision: bfb278372633c50ae595f0b89241a143090c967e
URL: https://github.com/llvm/llvm-project/commit/bfb278372633c50ae595f0b89241a143090c967e DIFF: https://github.com/llvm/llvm-project/commit/bfb278372633c50ae595f0b89241a143090c967e.diff LOG: [lldb/Reproducers] Make SBStream::Print an API instead of a SWIG extension This makes it possible to instrument the call for the reproducers. This fixes TestStructuredDataAPI.py with reproducer replay. Differential revision: https://reviews.llvm.org/D80312 Added: Modified: lldb/bindings/interface/SBStream.i lldb/include/lldb/API/SBStream.h lldb/source/API/SBStream.cpp Removed: ################################################################################ diff --git a/lldb/bindings/interface/SBStream.i b/lldb/bindings/interface/SBStream.i index 31fb3802bf62..edd67f87c3fb 100644 --- a/lldb/bindings/interface/SBStream.i +++ b/lldb/bindings/interface/SBStream.i @@ -62,14 +62,8 @@ public: size_t GetSize(); - // wrapping the variadic Printf() with a plain Print() - // because it is hard to support varargs in SWIG bridgings - %extend { - void Print (const char* str) - { - self->Printf("%s", str); - } - } + void + Print (const char* str); void RedirectToFile (const char *path, bool append); diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h index 7f0ec49b81c5..6b3753d45aa2 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -37,6 +37,8 @@ class LLDB_API SBStream { void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); + void Print(const char *str); + void RedirectToFile(const char *path, bool append); void RedirectToFile(lldb::SBFile file); diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp index 5d77410434a2..0f49c5111f28 100644 --- a/lldb/source/API/SBStream.cpp +++ b/lldb/source/API/SBStream.cpp @@ -60,6 +60,12 @@ size_t SBStream::GetSize() { return static_cast<StreamString *>(m_opaque_up.get())->GetSize(); } +void SBStream::Print(const char *str) { + LLDB_RECORD_METHOD(void, SBStream, Print, (const char *), str); + + Printf("%s", str); +} + void SBStream::Printf(const char *format, ...) { if (!format) return; @@ -204,6 +210,7 @@ void RegisterMethods<SBStream>(Registry &R) { LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileHandle, (FILE *, bool)); LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileDescriptor, (int, bool)); LLDB_REGISTER_METHOD(void, SBStream, Clear, ()); + LLDB_REGISTER_METHOD(void, SBStream, Print, (const char *)); } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits