From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A51CC2B702 for ; Fri, 21 Sep 2018 09:20:59 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gj1r5VQbCzlJ for ; Fri, 21 Sep 2018 09:20:59 -0400 (EDT) Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 5BCBA2B69A for ; Fri, 21 Sep 2018 09:20:59 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH 2/3] Proper unwind for currently executing fiber Date: Fri, 21 Sep 2018 16:20:54 +0300 Message-Id: <7b844650e2e0799813e82b32ea2d637982bc3395.1537535602.git.georgy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko 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