Skip to content

Commit b328dcb

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
1 parent 8cb804a commit b328dcb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lldb/include/lldb/Utility/ReproducerInstrumentation.h

+2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ template <typename... Ts> inline std::string stringify_args(const Ts &... ts) {
177177
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...) \
178178
lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
179179
stringify_args(__VA_ARGS__));
180+
#define LLDB_RECORD_DUMMY_NO_ARGS(Result, Class, Method) \
181+
lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION);
180182

181183
namespace lldb_private {
182184
namespace repro {

lldb/source/API/SBDebugger.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,14 @@ SBFile SBDebugger::GetErrorFile() {
430430
}
431431

432432
void SBDebugger::SaveInputTerminalState() {
433-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
433+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, SaveInputTerminalState);
434434

435435
if (m_opaque_sp)
436436
m_opaque_sp->SaveInputTerminalState();
437437
}
438438

439439
void SBDebugger::RestoreInputTerminalState() {
440-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
440+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, RestoreInputTerminalState);
441441

442442
if (m_opaque_sp)
443443
m_opaque_sp->RestoreInputTerminalState();
@@ -1093,7 +1093,7 @@ void SBDebugger::DispatchInput(const void *data, size_t data_len) {
10931093
}
10941094

10951095
void SBDebugger::DispatchInputInterrupt() {
1096-
LLDB_RECORD_METHOD_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
1096+
LLDB_RECORD_DUMMY_NO_ARGS(void, SBDebugger, DispatchInputInterrupt);
10971097

10981098
if (m_opaque_sp)
10991099
m_opaque_sp->DispatchInputInterrupt();
@@ -1253,8 +1253,7 @@ uint32_t SBDebugger::GetTerminalWidth() const {
12531253
}
12541254

12551255
void SBDebugger::SetTerminalWidth(uint32_t term_width) {
1256-
LLDB_RECORD_METHOD(void, SBDebugger, SetTerminalWidth, (uint32_t),
1257-
term_width);
1256+
LLDB_RECORD_DUMMY(void, SBDebugger, SetTerminalWidth, (uint32_t), term_width);
12581257

12591258
if (m_opaque_sp)
12601259
m_opaque_sp->SetTerminalWidth(term_width);

0 commit comments

Comments
 (0)