XCode Debugging From Source Code

Joined
Apr 25, 2008
Messages
1
Reaction score
0
Points
1
I'm pretty new to programming. I got my hands on a beginner's book for C++ with a series of basic programs to type up, and I've been using XCode 1.5 on my OS 10.3.9 Powerbook to play around with it. I got through to the last chapter, which is on inheritance and polymorphism, and I get to the last sample program, a simple Blackjack program. I type it up and compile, and the program crashes early on a segfault.

Rather than comb the program for the error, I decide that this would be a good chance to figure out how to use XCode's debugger. The help pages I've been finding about XCode seem to suggest that I should be able to debug the program from the source code and see how things are linking together so I could find the exact line where things are messing up.

However, when I open the debugger, I hit a couple of problems. First of all, the debugger doesn't load the source code. If I pause the program in operation, I get some machine code to pop up, but I can't get the debug to actually run off the source. I can even go to the source code in the list of "targets" on the sidebar of the main window and drag it into the debug window, but it'll then basically ignore that and go back to dumping me off on the machine code.

Second, the segfault is occurring right after I get prompted to input a "how many players?" variable. When I run the program from the debugger, I can't seem to be able to give an input for that variable. For example, if I type "1" and hit enter, the cursor will just jump to the next line and leave white space. If I pause the program, the line "Undefined command: "1". Try "help"," pops up.

I've been looking around the net for some hints on making things run, but I'm not getting anything but the basic help pages. Could I get a hand with the troubleshooting?

http://ohnoabear.com/dreamshade/debug0.jpg
This is the console window on running the program.

http://ohnoabear.com/dreamshade/debug1.jpg
This is what happens when I "build and debug" the program. The program itself does not show up in the debug window. If I enter a number for the prompt in the console window, I come back with nothing.

http://ohnoabear.com/dreamshade/debug2.jpg
If I pause the program, this occurs.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top