From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 11 08:05:48 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C11F1410 for ; Tue, 11 Jun 2013 08:05:48 +0000 (UTC) (envelope-from vagner@bsdway.ru) Received: from bsdway.ru (bsdway.ru [62.109.17.46]) by mx1.freebsd.org (Postfix) with ESMTP id 32C2D126A for ; Tue, 11 Jun 2013 08:05:45 +0000 (UTC) Received: from localhost (off-180.addr.fotocdn.net [193.105.179.180]) (authenticated bits=0) by bsdway.ru (8.14.4/8.14.5) with ESMTP id r5B85ckH051129; Tue, 11 Jun 2013 12:05:39 +0400 (MSD) (envelope-from vagner@bsdway.ru) Date: Tue, 11 Jun 2013 12:05:38 +0400 From: Vagner To: Konstantin Belousov Subject: Re: Where is stack of program? Message-ID: <20130611080538.GA2645@vagner-wrk.bsdway.ru> Mail-Followup-To: Konstantin Belousov , FreeBSD hackers Mail List References: <20130610164425.GA2966@vagner-wrk.bsdway.ru> <20130611054544.GI3047@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130611054544.GI3047@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bsdway.ru [62.109.17.46]); Tue, 11 Jun 2013 12:05:39 +0400 (MSD) Cc: FreeBSD hackers Mail List X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 08:05:48 -0000 On 08:45 Tue 11 Jun , Konstantin Belousov wrote: > On Mon, Jun 10, 2013 at 08:44:25PM +0400, Vagner wrote: > > Hi! > > I need method of finding in struct vm_map or vm_object segments of > > memory which is situated in the stack. > > Can you help me please? > > Note that the stack is per-thread. The concept is somewhat machine-specific, > some architectures utilize two stacks, on some the stack is purely software > convention. > > You did not specified what context your code is to be run, e.g. is > it kernel or user space ? Assuming it is kernel since you mentioned > vm_something. The least error prone route is the thread context (frame) > -> tf_esp on i386 (or tf_rsp on amd64) -> lookup of the map entry in the > process p_vmspace. > > In reality, the stack is often fragmented, since the stack grow code > does not coalesce the adjacent grow-down map entries. I asket the question because in my servers run very large daemons (writed their own). Then daemons get signal for create coredump, downtime approximately 1h. This is very long for daemons in production. Often in coredump for debug need only stack and current frame of code, but in function, which initialise for create dump of memory haven't this possibility. Linux have /proc/self/coredump_filter for settings what segments included in core file, but in our FreeBSD I don't find this:( Help me for find solution please -- Respectfully, Stanislav Putrya System administrator FotoStrana.Ru Ltd. ICQ IM: 328585847 Jabber-GoogleTalk: root.vagner mob.phone SPB: +79215788755 mob.phone RND: +79525600664 email: vagner[at]bsdway.ru email: putrya[at]playform.ru email: root.vagner[at]gmail.com site: bsdway.ru site: fotostrana.ru ---------------------------------------- ( ) ASCII ribbon campaign X - against HTML, vCards and / \ - proprietary attachments in e-mail