Where is stack of program?
Vagner
vagner at bsdway.ru
Tue Jun 11 20:21:36 UTC 2013
On 12:05 Tue 11 Jun , Vagner wrote:
> 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
>
My solution.
I added new option MALLOC_OPTIONS ("S") in environment variable for malloc(3).
Also I added new `if' in function pages_map at libc/stdlib. In this `if' I added option MAP_NOCORE
(mmap(2)) for segments allocated with MAP_PRIVATE | MAP_ANON. Patch file
attached.
As a result: I have a corefile with stack and text of program ~ 2Mb (above
- 2Gb).
Thanks to all
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core_only_stack.patch
Type: text/x-diff
Size: 1275 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20130612/69adefb1/attachment.patch>
More information about the freebsd-hackers
mailing list