FreeBSD and Debugging?
Dan Nelson
dnelson at allantgroup.com
Sun Apr 11 09:30:22 PDT 2004
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 at allantgroup.com
More information about the freebsd-hackers
mailing list