forked from OSchip/llvm-project
[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
This commit is contained in:
parent
b8cbff51d3
commit
bfb2783726
|
@ -62,14 +62,8 @@ public:
|
||||||
size_t
|
size_t
|
||||||
GetSize();
|
GetSize();
|
||||||
|
|
||||||
// wrapping the variadic Printf() with a plain Print()
|
void
|
||||||
// because it is hard to support varargs in SWIG bridgings
|
Print (const char* str);
|
||||||
%extend {
|
|
||||||
void Print (const char* str)
|
|
||||||
{
|
|
||||||
self->Printf("%s", str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RedirectToFile (const char *path, bool append);
|
RedirectToFile (const char *path, bool append);
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
|
|
||||||
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
|
void Print(const char *str);
|
||||||
|
|
||||||
void RedirectToFile(const char *path, bool append);
|
void RedirectToFile(const char *path, bool append);
|
||||||
|
|
||||||
void RedirectToFile(lldb::SBFile file);
|
void RedirectToFile(lldb::SBFile file);
|
||||||
|
|
|
@ -60,6 +60,12 @@ size_t SBStream::GetSize() {
|
||||||
return static_cast<StreamString *>(m_opaque_up.get())->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, ...) {
|
void SBStream::Printf(const char *format, ...) {
|
||||||
if (!format)
|
if (!format)
|
||||||
return;
|
return;
|
||||||
|
@ -204,6 +210,7 @@ void RegisterMethods<SBStream>(Registry &R) {
|
||||||
LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileHandle, (FILE *, bool));
|
LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileHandle, (FILE *, bool));
|
||||||
LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileDescriptor, (int, bool));
|
LLDB_REGISTER_METHOD(void, SBStream, RedirectToFileDescriptor, (int, bool));
|
||||||
LLDB_REGISTER_METHOD(void, SBStream, Clear, ());
|
LLDB_REGISTER_METHOD(void, SBStream, Clear, ());
|
||||||
|
LLDB_REGISTER_METHOD(void, SBStream, Print, (const char *));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue