From 9cb4e7725f668318d08cb79b1459a04eadf2f925 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 6 Jun 2019 09:54:29 +1200 Subject: [PATCH] Handle (empty) backtrace when thread is not born yet. --- vm_backtrace.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vm_backtrace.c b/vm_backtrace.c index bb01983a7c..4f92439478 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -451,6 +451,12 @@ backtrace_each(const rb_execution_context_t *ec, const rb_control_frame_t *cfp; ptrdiff_t size, i; + // In the case the thread vm_stack or cfp is not initialized, there is no backtrace. + if (start_cfp == NULL) { + init(arg, 0); + return; + } + /* <- start_cfp (end control frame) * top frame (dummy) * top frame (dummy)