Skip to content

Commit 6a544b7

Browse files
committed
[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! llvm-svn: 374104 (cherry picked from commit b328dcb)
1 parent 008b8e1 commit 6a544b7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lldb/include/lldb/Utility/ReproducerInstrumentation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ template <typename... Ts> inline std::string stringify_args(const Ts &... ts) {
175175
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...) \
176176
lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
177177
stringify_args(__VA_ARGS__));
178+
#define LLDB_RECORD_DUMMY_NO_ARGS(Result, Class, Method) \
179+
lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION);
178180

179181
namespace lldb_private {
180182
namespace repro {

lldb/source/API/SBDebugger.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,14 @@ FILE *SBDebugger::GetErrorFileHandle() {
365365
}
366366

367367
void SBDebugger::SaveInputTerminalState() {
368-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
368+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
369369

370370
if (m_opaque_sp)
371371
m_opaque_sp->SaveInputTerminalState();
372372
}
373373

374374
void SBDebugger::RestoreInputTerminalState() {
375-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
375+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
376376

377377
if (m_opaque_sp)
378378
m_opaque_sp->RestoreInputTerminalState();
@@ -1033,7 +1033,7 @@ void SBDebugger::DispatchInput(const void *data, size_t data_len) {
10331033
}
10341034

10351035
void SBDebugger::DispatchInputInterrupt() {
1036-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
1036+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
10371037

10381038
if (m_opaque_sp)
10391039
m_opaque_sp->DispatchInputInterrupt();
@@ -1193,8 +1193,7 @@ uint32_t SBDebugger::GetTerminalWidth() const {
11931193
}
11941194

11951195
void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1196-
LLDB_RECORD_METHOD(void, SBDebugger, SetTerminalWidth, (uint32_t),
1197-
term_width);
1196+
LLDB_RECORD_DUMMY(void, SBDebugger, SetTerminalWidth, (uint32_t), term_width);
11981197

11991198
if (m_opaque_sp)
12001199
m_opaque_sp->SetTerminalWidth(term_width);

0 commit comments

Comments
 (0)