Reputation: 429
Does anyone know where I might find the code that implements OS X's version of backtrace()
? I know it's probably somewhere inside libSystem.B.dylib
, so I should probably get that module's source code from Apple's read-only open-source repository, but where inside it should I start looking?
Upvotes: 1
Views: 705
Reputation: 8116
backtrace()
http://www.opensource.apple.com/source/Libc/Libc-1044.1.2/gen/backtrace.c
_thread_stack_pcs()
http://www.opensource.apple.com/source/Libc/Libc-1044.1.2/gen/thread_stack_pcs.c
Upvotes: 2
Reputation: 90611
Actually, most of this stuff is in Libc. In particular, backtrace()
is defined here. However, that's mostly just a thin wrapper around the internal function _thread_stack_pcs()
, which is defined here.
The easiest way to find this sort of stuff is perhaps Google. For example, searching for "backtrace" site:opensource.apple.com
leads you to an older version of Libc. Then, you can start from the top of http://opensource.apple.com to find the version that's used in a given version of the OS.
Upvotes: 6