[tarantool-patches] [PATCH 2/3] Proper unwind for currently executing fiber

Georgy Kirichenko georgy at tarantool.org
Fri Sep 21 16:20:54 MSK 2018


A fiber's coro context stores execution state for a corresponding
already yielded fiber. If fiber is on the execution then it hasn't
valid stored coro state and might be backtraced without a special unwind
context builder.
---
 src/backtrace.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/backtrace.cc b/src/backtrace.cc
index 2512bc045..70ed913e0 100644
--- a/src/backtrace.cc
+++ b/src/backtrace.cc
@@ -368,7 +368,10 @@ backtrace_foreach(backtrace_cb cb, coro_context *coro_ctx, void *cb_ctx)
 {
 	unw_cursor_t unw_cur;
 	unw_context_t unw_ctx;
-	coro_unwcontext(&unw_ctx, coro_ctx);
+	if (coro_ctx != NULL)
+		coro_unwcontext(&unw_ctx, coro_ctx);
+	else
+		unw_getcontext(&unw_ctx);
 	unw_init_local(&unw_cur, &unw_ctx);
 	int frame_no = 0;
 	unw_word_t sp = 0, old_sp = 0, ip, offset;
-- 
2.19.0





More information about the Tarantool-patches mailing list