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/verify-sign/tz-link.htm?a=commitdiff_plain;h=2af99c141d1afe1d03bf1c9107e258e6bf912414;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;