• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I debug this? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I debug this? [SOLVED]


  • Subject: Re: How do I debug this? [SOLVED]
  • From: Graham Cox <email@hidden>
  • Date: Sat, 11 Oct 2008 16:01:28 +1100

Thanks to everyone who responded - I found the problem. Though I had breakpoints set on [NSException raise], by the time the breakpoint was hit there was nothing on the stack trace from my code. Breaking on objc_exception_throw didn't work either (that's called even later). However by temporarily adding try/catch around the code that I suspected contained the fault allowed me to stop in the catch block which had a stack trace that revealed the problem.

Curiously, it turned out one of my earlier 'hunches' was right on the money.

I'm a bit mystified why the stack trace wasn't showing up in the first case, it otherwise works fine AFAICS. Anyhoo, this one's fixed.

thanks, Graham


On 11 Oct 2008, at 12:36 am, Ashley Clark wrote:

Stack trace:

#0	0x92badc66 in -[NSException raise]
#1	0x901c3283 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
#2	0x901a0122 in AppKitMenuEventHandler
#3	0x90c79303 in DispatchEventToHandlers
#4	0x90c7873d in SendEventToEventTargetInternal
#5	0x90c95092 in SendEventToEventTarget
#6	0x90cc931d in SendHICommandEvent
#7	0x90cefb6f in SendMenuCommandWithContextAndModifiers
#8	0x90cefb2c in SendMenuItemSelectedEvent
#9	0x90cefa3e in FinishMenuSelection
#10	0x90ccc5cc in MenuSelectCore
#11	0x90ccbfb7 in _HandleMenuSelection2
#12	0x90ccbe2b in _HandleMenuSelection
#13	0x900dcad3 in _NSHandleCarbonMenuEvent
#14	0x900438dc in _DPSNextEvent
#15	0x90042ca0 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#16	0x9003bcdb in -[NSApplication run]
#17	0x90008f14 in NSApplicationMain
#18	0x00004e73 in main at main.m:13

Leading to the message:

2008-10-10 15:57:59.552 Ortelius[43213:813] *** -[NSCFArray
objectAtIndex:]: index (0) beyond bounds (0)

How can I find out what array is being overrun here? There's no code
of my own in the stack trace at this point, which appears to be the
tail end of a menu selection (which makes sense, as it occurs during
loading a file in response to the "Open" menu command). So far I've
just been trying to guess what the problem might be by following
'hunches' but so far drawn a blank.


Have you tried setting a breakpoint on objc_exception_throw? That should
show you the moment the exception is being created and should let you know
who's calling the objectAtIndex:0 method.


Just doing a simple test here I get a stack trace that looks like this:

#0	0x96f9ee17 in objc_exception_throw
#1	0x968a1f2b in +[NSException raise:format:arguments:]
#2	0x968a1f6a in +[NSException raise:format:]
#3	0x95587bbf in _NSArrayRaiseBoundException
#4	0x95505548 in -[NSCFArray objectAtIndex:]
#5	0x0001fdb6 in -[JTApplicationDelegate showInventoryInformation:] at
JTApplicationDelegate.m:35
#6	0x95907b03 in -[NSApplication sendAction:to:from:]
#7	0x959b6540 in -[NSMenu performActionForItemAtIndex:]
#8	0x959b6245 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
...snip...
#25	0x00002220 in main at main.m:13


-- Ashley Clark


_______________________________________________

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


References: 
 >How do I debug this? (From: Graham Cox <email@hidden>)
 >Re: How do I debug this? (From: "Ashley Clark" <email@hidden>)

  • Prev by Date: Re: Strategy for naming support folder
  • Next by Date: Opening a document from stationery
  • Previous by thread: Re: How do I debug this?
  • Next by thread: KVC Question
  • Index(es):
    • Date
    • Thread