From: David van Moolenbroek Date: Thu, 29 Aug 2013 22:57:16 +0000 (+0200) Subject: libmthread: do not dump stack for free threads X-Git-Tag: v3.3.0~605 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/index.css?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F953%2F2;p=minix.git libmthread: do not dump stack for free threads Change-Id: Ic438a252f5bddaf1513f554c71173e6fffb0c674 --- diff --git a/lib/libmthread/misc.c b/lib/libmthread/misc.c index 86c8800ac..51c99c8ab 100644 --- a/lib/libmthread/misc.c +++ b/lib/libmthread/misc.c @@ -122,10 +122,14 @@ void mthread_stacktrace(mthread_thread_t t) mcontext_t *mtx; struct stackframe_s *frame; - printf("thread %d: ", t); - tcb = mthread_find_tcb(t); ctx = &tcb->m_context; + + if (t != MAIN_THREAD && ctx->uc_stack.ss_size == 0) + return; /* no stack, no stacktrace */ + + printf("thread %d: ", t); + mtx = &ctx->uc_mcontext; frame = &mtx->mc_p_reg; bp = frame->fp;