From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 11 09:30:22 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 29CD616A4D0 for ; Sun, 11 Apr 2004 09:30:22 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F70E43D4C for ; Sun, 11 Apr 2004 09:30:07 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i3BGTvdU008543; Sun, 11 Apr 2004 11:29:57 -0500 (CDT) (envelope-from dan) Date: Sun, 11 Apr 2004 11:29:57 -0500 From: Dan Nelson To: Ted Unangst Message-ID: <20040411162941.GA1319@dan.emsphone.com> References: <6.0.2.0.2.20040409230629.01cc1ec0@mx1.erhartgroup.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: Brandon Erhart cc: freebsd-hackers@freebsd.org Subject: Re: FreeBSD and Debugging? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2004 16:30:22 -0000 In the last episode (Apr 10), Ted Unangst said: > On Fri, 9 Apr 2004, Brandon Erhart wrote: > > Are there any debuggers out there for BSD that will detect the > > heap/stack corruption!? > > valgrind and electric fence are very good suggestions. my own > personal pet project was adding guard pages to the system malloc. > then linking malloc.conf -> AFGJ or setenv MALLOC_OPTIONS and you can > find bugs in all the software you run. it's less complete than a > dedicated heap checker, but lightweight enough (well, 20% penalty may > not be light for some) that i run with it full time. we've had a > fairly significant amount of success with it finding bugs in software > that just happened to work. > > http://www.zeitbombe.org/patches/malloc_guard.diff should apply pretty > cleanly to freebsd's malloc.c I also have a malloc debugging patch that changes the Junk flag to fill with a counter value, so you can track down where in your program a particular block of memory was allocated/freed. http://dan.allantgroup.com/FreeBSD/malloc.diff , or PR 52907 -- Dan Nelson dnelson@allantgroup.com