Re: How to Debug a Nib-Load - Binding error
Re: How to Debug a Nib-Load - Binding error
- Subject: Re: How to Debug a Nib-Load - Binding error
- From: Alastair Houghton <email@hidden>
- Date: Tue, 8 Jan 2008 17:21:27 +0000
On 8 Jan 2008, at 16:36, Steve Cronin wrote:
I have a 'double free - set breakpoint in szone_error' which is
eluding me.
In pursuit of this I have set a global breakpoint for both
'szone_error' and [NSException raise].
Is this the right thing to do?
Well just szone_error is needed to catch your double free. By adding
the other breakpoint, you've actually caught another problem.
When I attempt to launch now I get the stack shown below when I land
in the debugger.
How do I go about figuring out where this is occurring?
You've already answered that question yourself:
I can tell its a binding error in a nib. Which nib?
How do I get the Object and KeyPath out of line #8?
It's a little tricky because you don't have full debug symbols for
that code (and I don't think Apple provides debug symbols for the
Cocoa frameworks as a separate download...), so GDB doesn't know the
names or stack frame offsets of the parameters. However, the
exception itself probably contains the name of the thing that it can't
bind, and by default exceptions result in log output, so just letting
the code continue will probably give you some more information.
It *is* possible to read the code to find the address of the NSString
containing the nib file name, or to find the arguments in frame 8.
But you need to be confident at reading (and correctly interpreting)
assembly code on whichever architecture you're debugging and it can
get a little involved.
Incidentally, as to which nib file you need to look in, I think it's
probably your main nib file. Why do I say that? Because the nib file
causing the trouble is being loaded by NSApplicationMain(), not from a
user function or method.
Can I enter something useful (a debugger command?) in the breakpoint
window
No, but you can enter debugger commands in the console window.
What is the best source of a document along the lines of 'how to use
the XCode Debugger: 20 case studies'?
I don't know of one, but then I was already familiar with GDB.
As to what you should do next, if it was my program, I think I'd let
the exception fire and check the log window to see what it said. It
almost certainly includes information about which key it can't set,
which should give you a big clue. Cocoa is quite good at outputting
useful information in exceptions, so it's often a good idea to start
there.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden