I've been trying to figure out a way on how to calculate the exact symbol addresses from stack adresses I get from the crash reports. I've found the following formula: https://stackoverflow.com/a/12464678/920407
And tried using a tool I found that calculates the address for me: https://github.com/nob1984/natos
But allas neither of these methods worked, though the error margin was relatively small - about 3-4 lines before the actual line that the error occurred in.
I deliberately forced the app to crash with overshooting an NSArray object bounds. This is my result:
crash report:
0 CoreFoundation 0x36bf688f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x3300d259 objc_exception_throw + 33
2 CoreFoundation 0x36b4e23d -[__NSArrayI objectAtIndex:] + 165
3 SomeApp 0x0013cea3 -[DashboardTableViewController tableView:didSelectRowAtIndexPath:] (DashboardTableViewController.m:970)
4 UIKit 0x34e7993d -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 945
5 UIKit 0x34ef3627 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 159
6 Foundation 0x32829933 __NSFireDelayedPerform + 415
7 CoreFoundation 0x36bcaa33 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
8 CoreFoundation 0x36bca699 __CFRunLoopDoTimer + 365
9 CoreFoundation 0x36bc926f __CFRunLoopRun + 1207
10 CoreFoundation 0x36b4c4a5 CFRunLoopRunSpecific + 301
11 CoreFoundation 0x36b4c36d CFRunLoopRunInMode + 105
12 GraphicsServices 0x34d13439 GSEventRunModal + 137
13 UIKit 0x34df5cd5 UIApplicationMain + 1081
14 SomeApp 0x00146587 main (main.m:17)
15 SomeApp 0x00102008 start + 40
natos output:
Main Stack Address == 0x146587
Target Stack Address == 0x13cea3
Slide == 0x1000
Main Symbol Address == 0x4751c
Load Address == 0x10006b
Target Symbol Address == 0x3de38
dwarfdump output:
(null)
atos output:
-[DashboardTableViewController tableView:viewForHeaderInSection:] (in SomeApp) (DashboardTableViewController.m:966)
As the Apple Crash report states the code line is actually in 970 and not 966. I wonder what's causing this error and what should one use to calculate the address correctly.