[Lldb-commits] [PATCH] D80312: [lldb/Reproducers] Make SBStream::Print a first-class API instead of a SWIG extension
This revision was automatically updated to reflect the committed changes. Closed by commit rGbfb278372633: [lldb/Reproducers] Make SBStream::Print an API instead of a SWIG extension (authored by JDevlieghere). Herald added a project: LLDB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80312/new/ https://reviews.llvm.org/D80312 Files: lldb/bindings/interface/SBStream.i lldb/include/lldb/API/SBStream.h lldb/source/API/SBStream.cpp Index: lldb/source/API/SBStream.cpp === --- lldb/source/API/SBStream.cpp +++ lldb/source/API/SBStream.cpp @@ -60,6 +60,12 @@ return static_cast(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 @@ 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 *)); } } Index: lldb/include/lldb/API/SBStream.h === --- lldb/include/lldb/API/SBStream.h +++ lldb/include/lldb/API/SBStream.h @@ -37,6 +37,8 @@ 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); Index: lldb/bindings/interface/SBStream.i === --- lldb/bindings/interface/SBStream.i +++ lldb/bindings/interface/SBStream.i @@ -62,14 +62,8 @@ 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); Index: lldb/source/API/SBStream.cpp === --- lldb/source/API/SBStream.cpp +++ lldb/source/API/SBStream.cpp @@ -60,6 +60,12 @@ return static_cast(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 @@ 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 *)); } } Index: lldb/include/lldb/API/SBStream.h === --- lldb/include/lldb/API/SBStream.h +++ lldb/include/lldb/API/SBStream.h @@ -37,6 +37,8 @@ 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); Index: lldb/bindings/interface/SBStream.i === --- lldb/bindings/interface/SBStream.i +++ lldb/bindings/interface/SBStream.i @@ -62,14 +62,8 @@ 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); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D80312: [lldb/Reproducers] Make SBStream::Print a first-class API instead of a SWIG extension
JDevlieghere created this revision. JDevlieghere added reviewers: labath, teemperor. teemperor accepted this revision. This revision is now accepted and ready to land. This makes it possible to instrument the call for the reproducers. This fixes TestStructuredDataAPI.py with reproducer replay. Repository: rLLDB LLDB https://reviews.llvm.org/D80312 Files: lldb/bindings/interface/SBStream.i lldb/include/lldb/API/SBStream.h lldb/source/API/SBStream.cpp Index: lldb/source/API/SBStream.cpp === --- lldb/source/API/SBStream.cpp +++ lldb/source/API/SBStream.cpp @@ -60,6 +60,12 @@ return static_cast(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 @@ 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 *)); } } Index: lldb/include/lldb/API/SBStream.h === --- lldb/include/lldb/API/SBStream.h +++ lldb/include/lldb/API/SBStream.h @@ -37,6 +37,8 @@ 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); Index: lldb/bindings/interface/SBStream.i === --- lldb/bindings/interface/SBStream.i +++ lldb/bindings/interface/SBStream.i @@ -62,14 +62,8 @@ 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); Index: lldb/source/API/SBStream.cpp === --- lldb/source/API/SBStream.cpp +++ lldb/source/API/SBStream.cpp @@ -60,6 +60,12 @@ return static_cast(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 @@ 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 *)); } } Index: lldb/include/lldb/API/SBStream.h === --- lldb/include/lldb/API/SBStream.h +++ lldb/include/lldb/API/SBStream.h @@ -37,6 +37,8 @@ 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); Index: lldb/bindings/interface/SBStream.i === --- lldb/bindings/interface/SBStream.i +++ lldb/bindings/interface/SBStream.i @@ -62,14 +62,8 @@ 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); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits