[Lldb-commits] [lldb] r374104 - [Reproducer] Don't isntrument methods that get called from the signal handler.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 8 12:17:43 PDT 2019
Author: jdevlieghere
Date: Tue Oct 8 12:17:42 2019
New Revision: 374104
URL: http://llvm.org/viewvc/llvm-project?rev=374104&view=rev
Log:
[Reproducer] Don't isntrument methods that get called from the signal handler.
LLDB's signal handlers call SBDebugger methods, which themselves try to
be really careful about not doing anything non-signal safe. The
Reproducer record macro is not careful though, and does unsafe things
which potentially caused LLDB to crash. Given that these methods are not
particularly interesting I've swapped the RECORD macros with DUMMY ones,
so that we still register the API boundary but don't do anything
non-signal safe.
Thanks Jim for figuring this one out!
Modified:
lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
lldb/trunk/source/API/SBDebugger.cpp
Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=374104&r1=374103&r2=374104&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Tue Oct 8 12:17:42 2019
@@ -177,6 +177,8 @@ template <typename... Ts> inline std::st
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...) \
lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
stringify_args(__VA_ARGS__));
+#define LLDB_RECORD_DUMMY_NO_ARGS(Result, Class, Method) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION);
namespace lldb_private {
namespace repro {
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=374104&r1=374103&r2=374104&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Tue Oct 8 12:17:42 2019
@@ -430,14 +430,14 @@ SBFile SBDebugger::GetErrorFile() {
}
void SBDebugger::SaveInputTerminalState() {
- LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
+ LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
if (m_opaque_sp)
m_opaque_sp->SaveInputTerminalState();
}
void SBDebugger::RestoreInputTerminalState() {
- LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
+ LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
if (m_opaque_sp)
m_opaque_sp->RestoreInputTerminalState();
@@ -1093,7 +1093,7 @@ void SBDebugger::DispatchInput(const voi
}
void SBDebugger::DispatchInputInterrupt() {
- LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
+ LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
if (m_opaque_sp)
m_opaque_sp->DispatchInputInterrupt();
@@ -1253,8 +1253,7 @@ uint32_t SBDebugger::GetTerminalWidth()
}
void SBDebugger::SetTerminalWidth(uint32_t term_width) {
- LLDB_RECORD_METHOD(void, SBDebugger, SetTerminalWidth, (uint32_t),
- term_width);
+ LLDB_RECORD_DUMMY(void, SBDebugger, SetTerminalWidth, (uint32_t), term_width);
if (m_opaque_sp)
m_opaque_sp->SetTerminalWidth(term_width);
More information about the lldb-commits
mailing list