Re: Function to get current Backtrace and Address Slide
Re: Function to get current Backtrace and Address Slide
- Subject: Re: Function to get current Backtrace and Address Slide
- From: Wim Lewis <email@hidden>
- Date: Mon, 28 Feb 2011 17:13:18 -0800
On 28 Feb 2011, at 3:01 PM, Jerry Krinock wrote:
> Apparently I can get the slides by using the _dyld_xxx_xxx_xxx() functions from mach-o/dyld.h. I've tested the following and it seems to work. But since I'm completely out of my league with this stuff I thought I'd throw this code out there in case someone who knows what they're doing sees something that is going to blow up. In particular, I'm not sure that it is 64-bit clean.
You should ideally use intptr_t (or uintptr_t) in cases where you're storing a memory address in a non-pointer variable, like 'slide'. Not critically important, since IIRC 'long' will work perfectly well on the architectures that OSX currently runs on.
Other than that, the only thing that occurs to me is that it can also be handy to include the build UUID of each non-system executable in your backtraces, so that you can confidently associate the backtrace with your archived copy of the build that generated it. (You can get the info using _dyld_get_image_header() and looking for the LC_UUID load command.)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden