Finding an exception in Objective c code
I am debugging my application on iphone (OS 2.0) using X-code 3.1 iphone SDK 3.0 beta 5. My application throws the message * Application terminated due to an unmapped "NSRangeException", reason: "* - [NSCFArray insertObject: atIndex:] : index (8) out of bounds (8) '2009-05-23 17: 13: 32.304 myApp [405: 5a07] Stack: (808163835, 806099672, 807978623, 807978527, 812332907, 812067179, 812067103, 126035, 812081649, 812081343 , 826526801)
In gdb, when I give commands (gdb) info line 126035 Line number 126035 is out of range for "/ Users / videomac / manish / EXPLab / 2009-05-18-12-27 myApp / main.m".
(gdb) info line * 126035 Line 527 "/ Users / videomac / manish / EXPLab / 2009-05-18-12-27 myApp / Classes / PlaybackThread / Playback.m" starts at address 0x1ec52 <- [Playback startPlaybackThread:] + 514> and ends with 0x1ec6a <- [Play startPlaybackThread:] + 538>.
this means that the crash is related to the code in my method [Play startPlaybackThread:] what does no mean +514 and +538, do they mean line no?
Is there any other way to find the cause of the crashes?
a source to share
About the first error you mentioned from - insertObject: atIndex: documentation:
Important : Throws an NSRangeException if the index is greater than the number of elements in the array.
I would search for calls to this method trying to find which one is causing the error.
The numbers +514 and +538 give the offset from the instruction code immediately before that.
a source to share