-
Apple documentation
-
Calling conventions (stack frames and registers)
Basic information is scattered through [the Mac debugging techniques article](http://developer.apple.com/technotes/tn2004/tn2124.html). Much fuller information is available here: * [OS X ABI Function Call Guide](http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/000-Introduction/introduction.html) * [AMD64 Processor ABI](http://x86-64.org/documentation/abi.pdf)
-
X86/X86_64 assembly instructions
-
This excellent utility dumps the equivalent of full header information from an Objective-C binary.
-
Disassemblers
I can't find any decent open-source disassemblers, but Hopper Disassembler is decent and not too expensive. It's very good at following cross-references, so that (for example) you can find both a method's implementation and the code it's called from.
You can also get a reasonably good assembly code listing of a particular function in a binary using
otool -t -v -V -p function_name binary
-
Apple makes the source-code available for significant parts of OS X, which can be very useful for tracing undocumented behavior -- for example dyld, libobjc, gcc, clang, llvm and xnu (the Mach kernel).
-
Interpose libraries
These are small libraries that can be used to hook C/C++ methods or swizzle Objective-C methods in running, unaltered applications. I've written a template which is included in this package: * [`Makefile`](InterposeLibraryTemplate/Makefile) * [`interpose.mm`](InterposeLibraryTemplate/interpose.mm)
-
CoreSymbolication framework
An undocumented Apple framework, available on SnowLeopard (OS X 10.6) and up, that can be used to programmatically examine the call stack in a running program -- for example to display a trace of the current call stack.
The best source for how to use this is my interpose library template from item 4 above.
-
gdb
gdb
is Apple's default command-line debugger on OS X 10.8.5 and below. I don't know of any really good documentation for using it. I generally rely on its internal documentation and search on the web (as the need arises) for whatever that doesn't cover.The Mac Debugging Techniques article does have a lot of information on Apple-specific additions to
gdb
, though. -
lldb
lldb
is Apple's default command-line debugger on OS X 10.9.5 and up. It has even less documentation thangdb
, and the internal documentation is very spotty.I find I rely heavily on the LLDB to GDB Command Map