Skip to content

Commit 4dd2bb8

Browse files
pdillingerfacebook-github-bot
authored andcommitted
Fix stack trace trimming with LLDB (#12101)
Summary: I must have chosen trimming before frame 8 based on assertion failures, but that trims too many frame for a general segfault. So this changes to start printing at frame 4, as in this example where I've seeded a null deref: ``` Received signal 11 (Segmentation fault) Invoking LLDB for stack trace... Process 873208 stopped * thread #1, name = 'db_stress', stop reason = signal SIGSTOP frame #0: 0x00007fb1fe8f1033 libc.so.6`__GI___wait4(pid=873478, stat_loc=0x00007fb1fb114030, options=0, usage=0x0000000000000000) at wait4.c:30:10 thread #2, name = 'rocksdb:low', stop reason = signal SIGSTOP frame #0: 0x00007fb1fe8972a1 libc.so.6`__GI___futex_abstimed_wait_cancelable64 at futex-internal.c:57:12 Executable module set to "/data/users/peterd/rocksdb/db_stress". Architecture set to: x86_64-unknown-linux-gnu. True frame #4: 0x00007fb1fe844540 libc.so.6`__restore_rt at libc_sigaction.c:13 frame #5: 0x0000000000608514 db_stress`rocksdb::StressTest::InitDb(rocksdb::SharedState*) at db_stress_test_base.cc:345:18 frame #6: 0x0000000000585d62 db_stress`rocksdb::RunStressTestImpl(rocksdb::SharedState*) at db_stress_driver.cc:84:17 frame #7: 0x000000000058dd69 db_stress`rocksdb::RunStressTest(shared=0x00006120000001c0) at db_stress_driver.cc:266:34 frame #8: 0x0000000000453b34 db_stress`rocksdb::db_stress_tool(int, char**) at db_stress_tool.cc:370:20 ... ``` Pull Request resolved: #12101 Test Plan: manual (see above) Reviewed By: ajkr Differential Revision: D51593217 Pulled By: pdillinger fbshipit-source-id: 4a71eb8e516edbc32e682f9537bc77d073a7b4ed
1 parent f6fd4b9 commit 4dd2bb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

port/stack_trace.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ void PrintStack(int first_frames_to_skip) {
256256
if (lldb_stack_trace) {
257257
fprintf(stderr, "Invoking LLDB for stack trace...\n");
258258

259-
// Skip top ~8 frames here in PrintStack
259+
// Skip top ~4 frames here in PrintStack
260260
auto bt_in_lldb =
261-
"script -l python -- for f in lldb.thread.frames[8:]: print(f)";
261+
"script -l python -- for f in lldb.thread.frames[4:]: print(f)";
262262
execlp(/*cmd in PATH*/ "lldb", /*arg0*/ "lldb", "-p", attach_pid_str,
263263
"-b", "-Q", "-o", GetLldbScriptSelectThread(attach_tid), "-o",
264264
bt_in_lldb, (char*)nullptr);

0 commit comments

Comments
 (0)