问题
I downloaded LibC source from opensource.apple.com, but since it's part of one monolithic library /usr/lib/libSystem.B.dylib would I have to somehow rebuild the entire thing?
I have a BSD command line program, ported from Linux. I want to be able to set breakpoints in LibC functions and step through. I'm trying to close in on what seems to be heap corruption in my program (which doesn't occur on Linux - I've already ported back to Linux and run memcheck there.)
回答1:
Have you take a look at the Kernel Debug Kit from Apple (http://developer.apple.com/sdk/) ? I know that it contains kernel symbols, but I am not sure if libc is part of the SDK.
回答2:
You can build Valgrind yourself - either use the last version released on 10.5, or look on the bug tracker for the Snow Leopard support bug, which has a patch.
Alternately, try the memory debugging tools in the malloc(3) manual.
来源:https://stackoverflow.com/questions/1704648/on-mac-os-x-how-can-you-get-a-debug-build-of-system-libc-for-source-level-debug