OS X Bounds Checking
Thomas Ptacek | April 24th, 2005 | Filed Under: Uncategorized
Another useful GDB-ism, if you’re on OSX/Darwin (the excellence of which, as a development platform, should be fertile ground for future posts):
(gdb) define guard > set env DYLD_FORCE_FLAT_NAMESPACE 1 > set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.B.dylib > end
Stick this in your “.gdbinit”; type “guard” before running your program, and you get bounds-checking malloc.

