Jump to content
2 posts in this topic

Recommended Posts

OK, I've had it now. I've been working on a Cocoa/Obj-C project a bit, and it doesn't work too well - probably because I'm still very new to both Obj-C and Cocoa (but not programming in general).

Anyway, I set up a breakpoint on the first line in a function, and run/debug. As expected, it breaks on the breakpoint. However, that's pretty much all that seems to work OK.

 

This is the code in the beginning of the function (the variable "tmp" is for debugging, thus the name):

- (IBAction) fetchTagList:(id)sender
{
>>> NSMutableString *tag = [[NSMutableString alloc] initWithCapacity:50];
NSString *tmp = [tagList objectAtIndex: [listView selectedRow]]; // tagList is an NSArray, listView a poorly named NSTableView

if (!tmp)
	return;

 

So, the debugger stands on the first line, and I press "step over". It now stands on the second line, but "tag" is invalid (whatever that means). I press step over again, and it goes BACK to the first line! :(

Step over again, back to line 2. Step over, line 3 (empty), both tag and tmp are now invalid. The "if (!tmp)" doesn't match though, that is, it does NOT return.

 

What am I missing here?

It is, of course, entirely possible that the code (at least the 2nd line) should not work (I'm new, remember), but the debugger should in my opinion not go backwards! :wacko:

 

I've had some other odd problems with outlets too, despite adding the outlet, connecting it in IB and restarting both apps (just in case), the outlet was nil in code, until I created a new outlet with another name and reconnected that... Wtf? That has happened twice.

 

Edit: Also, could someone please check their Xcode version number? I've got 3.0 build 921.0, is that the "final"? Haven't bought Leopard (yet) ;)

 

 

Edit again: It seems I fixed the debugging issue, the project wasn't set to the Debug build configuration. :wacko: Isn't that the default?!

Also, debugging DID work in Release mode, at least partially.

Link to comment
https://www.insanelymac.com/forum/topic/72254-major-xcode-bugs/
Share on other sites

  • 7 months later...

It is important that the program is compiled in a manner that the debugger can handle. It there is much optimization going on during compilation then the stepping will not seem at all correct. Locations and variables are automatically overloaded for speed of execution etc.

 

Change the active executable to "debug" so that the debugger will be debugging code which is what you have actually written. :D

×
×
  • Create New...