From owner-freebsd-arch@FreeBSD.ORG Thu Jun 23 18:19:06 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0645D16A41C for ; Thu, 23 Jun 2005 18:19:06 +0000 (GMT) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2F9943D49 for ; Thu, 23 Jun 2005 18:19:03 +0000 (GMT) (envelope-from marcel@xcllnt.net) Received: from [192.168.4.250] (dhcp50.pn.xcllnt.net [192.168.4.250]) by ns1.xcllnt.net (8.13.3/8.13.3) with ESMTP id j5NIJ2eB003850; Thu, 23 Jun 2005 11:19:02 -0700 (PDT) (envelope-from marcel@xcllnt.net) In-Reply-To: <20050623102024.GA89874@frontfree.net> References: <20050623102024.GA89874@frontfree.net> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Marcel Moolenaar Date: Thu, 23 Jun 2005 11:19:01 -0700 To: Xin LI X-Mailer: Apple Mail (2.622) Cc: howardsue@gmail.com, freebsd-arch@freebsd.org Subject: Re: How to get stack from every thread when doing crash dump? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2005 18:19:06 -0000 On Jun 23, 2005, at 3:20 AM, Xin LI wrote: > One problem with the mini-dump is that, since the mini-dump utilizes: > dump_write((char *)curthread->td_kstack, curthread->td_kstack_pages * > PAGE_SIZE); > > To write out the stack, and at the point before exception.S, curthread > has > been changed, we can only obtain the stack from the current thread, > which > may not be enough for analyzing the backtrace. What can we do to > improve > this situation? You can iterate over all the threads. Take a look at src/sys/kern/subr_kdb.c or src/gnu/usr.bin/gdb/kgdb/kthr.c In particular: Use the list of all processes (allproc) to iterate over the processeses and for each process walk the list of threads and for each thread dump the stack, registers and other data. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net