Segmentation fault, _malloc_prefork () - debugging help needed

Dan Nelson dnelson at allantgroup.com
Mon Sep 19 17:57:21 UTC 2011


In the last episode (Sep 18), Unga said:
> I'm developing an multi-threaded application on FreeBSD.
> 
> When it is running for sometime, it develops a Segmentation fault.
> 
> The ddd debugger shows following:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 296c6580 (LWP 100137)]
> 0x28ee390e in _malloc_prefork () from /lib/libc.so.7
> 
> How could I know the exact line in source where this issue develops?

If you have a full /usr/src tree extracted, you can edit
/usr/src/lib/libc/Makefile and add

DEBUG_FLAGS=-g

at the top, then run "make obj && make depend && make && make install" to
install the new libc with debugging symbols.  Then your debugger will show
more info for functions inside libc.

If you don't have a source tree checked out yet, install the
devel/subversion-freebsd port, cd into /usr/src/ and run

svn co svn://svn.freebsd.org/base/stable/8 .

(or base/release/8.2.0, or base/stable/7 or base/head, depending on which
version you want; you can browse the branches at
http://svnweb.freebsd.org/base/ before you checkout anything)

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list