From owner-freebsd-questions@FreeBSD.ORG  Mon Sep 19 17:57:21 2011
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Delivered-To: freebsd-questions@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9EAC4106566B
	for <freebsd-questions@freebsd.org>;
	Mon, 19 Sep 2011 17:57:21 +0000 (UTC)
	(envelope-from dan@dan.emsphone.com)
Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116])
	by mx1.freebsd.org (Postfix) with ESMTP id 62D158FC13
	for <freebsd-questions@freebsd.org>;
	Mon, 19 Sep 2011 17:57:21 +0000 (UTC)
Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101])
	by email2.allantgroup.com (8.14.4/8.14.4) with ESMTP id p8JHvKbZ091949
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <freebsd-questions@freebsd.org>;
	Mon, 19 Sep 2011 12:57:20 -0500 (CDT)
	(envelope-from dan@dan.emsphone.com)
Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1])
	by dan.emsphone.com (8.14.5/8.14.5) with ESMTP id p8JHvKL7070247
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <freebsd-questions@freebsd.org>;
	Mon, 19 Sep 2011 12:57:20 -0500 (CDT)
	(envelope-from dan@dan.emsphone.com)
Received: (from dan@localhost)
	by dan.emsphone.com (8.14.5/8.14.5/Submit) id p8JHvJC3070245;
	Mon, 19 Sep 2011 12:57:19 -0500 (CDT) (envelope-from dan)
Date: Mon, 19 Sep 2011 12:57:19 -0500
From: Dan Nelson <dnelson@allantgroup.com>
To: Unga <unga888@yahoo.com>
Message-ID: <20110919175719.GI9801@dan.emsphone.com>
References: <1316347805.62034.YahooMailClassic@web160112.mail.bf1.yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1316347805.62034.YahooMailClassic@web160112.mail.bf1.yahoo.com>
X-OS: FreeBSD 8.2-STABLE
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Virus-Scanned: clamav-milter 0.97.2 at email2.allantgroup.com
X-Virus-Status: Clean
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6
	(email2.allantgroup.com [199.67.51.78]);
	Mon, 19 Sep 2011 12:57:20 -0500 (CDT)
X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78
Cc: freebsd-questions@freebsd.org
Subject: Re: Segmentation fault, _malloc_prefork () - debugging help needed
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
	<mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
	<mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Sep 2011 17:57:21 -0000

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@allantgroup.com