[Lldb-commits] [lldb] r355863 - [Reproducers] Implement log_append for function pointers.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 11 13:31:21 PDT 2019
Author: jdevlieghere
Date: Mon Mar 11 13:31:21 2019
New Revision: 355863
URL: http://llvm.org/viewvc/llvm-project?rev=355863&view=rev
Log:
[Reproducers] Implement log_append for function pointers.
Changing the type in the DUMMY macro to void* doesn't actually fix the
build error, because the argument type is deducted from the template (as
opposed to when serializing through the instrumentation framework, where
this would matter). Instead I've added a proper instance of log_append
that takes function pointers and logs their address.
Modified:
lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
lldb/trunk/source/API/SBCommunication.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBExpressionOptions.cpp
Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=355863&r1=355862&r2=355863&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Mon Mar 11 13:31:21 2019
@@ -37,6 +37,11 @@ inline void log_append(llvm::raw_string_
ss << t;
}
+template <typename T, typename... E>
+inline void log_append(llvm::raw_string_ostream &ss, T (*t)(E...)) {
+ ss << &t;
+}
+
template <>
inline void log_append<char>(llvm::raw_string_ostream &ss, const char *t) {
ss << t;
Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=355863&r1=355862&r2=355863&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Mon Mar 11 13:31:21 2019
@@ -157,7 +157,7 @@ bool SBCommunication::ReadThreadIsRunnin
bool SBCommunication::SetReadThreadBytesReceivedCallback(
ReadThreadBytesReceived callback, void *callback_baton) {
- LLDB_RECORD_DUMMY(bool, SBCommunication, void *,
+ LLDB_RECORD_DUMMY(bool, SBCommunication, SetReadThreadBytesReceivedCallback,
(lldb::SBCommunication::ReadThreadBytesReceived, void *),
callback, callback_baton);
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=355863&r1=355862&r2=355863&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Mon Mar 11 13:31:21 2019
@@ -141,11 +141,13 @@ SBError SBInputReader::Initialize(
unsigned long),
void *a, lldb::InputReaderGranularity b, char const *c, char const *d,
bool e) {
- LLDB_RECORD_DUMMY(lldb::SBError, SBInputReader, Initialize,
- (lldb::SBDebugger &, void *, void *,
- lldb::InputReaderGranularity, const char *, const char *,
- bool),
- sb_debugger, callback, a, b, c, d, e);
+ LLDB_RECORD_DUMMY(
+ lldb::SBError, SBInputReader, Initialize,
+ (lldb::SBDebugger &,
+ unsigned long (*)(void *, lldb::SBInputReader *, lldb::InputReaderAction,
+ const char *, unsigned long),
+ void *, lldb::InputReaderGranularity, const char *, const char *, bool),
+ sb_debugger, callback, a, b, c, d, e);
return SBError();
}
@@ -237,7 +239,8 @@ SBDebugger SBDebugger::Create(bool sourc
{
LLDB_RECORD_DUMMY(lldb::SBDebugger, SBDebugger, Create,
- (bool, void *, void *), source_init_files, callback, baton);
+ (bool, lldb::LogOutputCallback, void *), source_init_files,
+ callback, baton);
SBDebugger debugger;
@@ -1533,8 +1536,8 @@ bool SBDebugger::EnableLog(const char *c
void SBDebugger::SetLoggingCallback(lldb::LogOutputCallback log_callback,
void *baton) {
- LLDB_RECORD_DUMMY(void, SBDebugger, SetLoggingCallback, (void *, void *),
- log_callback, baton);
+ LLDB_RECORD_DUMMY(void, SBDebugger, SetLoggingCallback,
+ (lldb::LogOutputCallback, void *), log_callback, baton);
if (m_opaque_sp) {
return m_opaque_sp->SetLoggingCallback(log_callback, baton);
Modified: lldb/trunk/source/API/SBExpressionOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBExpressionOptions.cpp?rev=355863&r1=355862&r2=355863&view=diff
==============================================================================
--- lldb/trunk/source/API/SBExpressionOptions.cpp (original)
+++ lldb/trunk/source/API/SBExpressionOptions.cpp Mon Mar 11 13:31:21 2019
@@ -180,7 +180,7 @@ void SBExpressionOptions::SetLanguage(ll
void SBExpressionOptions::SetCancelCallback(
lldb::ExpressionCancelCallback callback, void *baton) {
LLDB_RECORD_DUMMY(void, SBExpressionOptions, SetCancelCallback,
- (void *, void *), callback, baton);
+ (lldb::ExpressionCancelCallback, void *), callback, baton);
m_opaque_up->SetCancelCallback(callback, baton);
}
More information about the lldb-commits
mailing list