On Dec 2, 2009, at 4:55 PM, Graham Cox wrote:

> When I get a stack trace in a crash report, as exampled below, can I use the 
> offsets (+71, +50) to locate the relevant line in the source code? What do 
> these numbers actually mean?

They're byte offsets from the start of the function, in the machine code.

I don't know of a good way to convert these back into line numbers. If you have 
that exact same version of the code open in Xcode (including configuration and 
architecture) you can choose Build > Show Assembly Code, then look for the 
function in the assembly; there are ".line" directives that show source line 
numbers, but unfortunately that listing doesn't show byte offsets. Or you can 
use otool to disassemble the function out of the binary, which includes the 
offsets but not the line numbers. :/

If you manage to solve that, you then have the lesser problem that optimized 
code is often heavily rearranged from the way it looks in the source, so the 
line numbers may not make much sense.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to