[Lldb-commits] [PATCH] D80312: [lldb/Reproducers] Make SBStream::Print a first-class API instead of a SWIG extension
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 20 10:54:42 PDT 2020
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<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 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80312.265296.patch
Type: text/x-patch
Size: 1785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200520/9ce72b10/attachment.bin>
More information about the lldb-commits
mailing list