Game Development Community

XCode Crash. Calls Non Existent Behavior

by rennie moffat · in iTorque 2D · 05/02/2011 (10:53 am) · 11 replies

Hi there,
I am getting a crash in XCode now. It is calling, at least the compile stops, always at one particular behavior. The thing is, this behavior has long been gone from my file. I have gone around, deleted all back ups that may have been in bad places (desktop etc), made sure the correct project is being loaded, cleaned, reloaded, double checked, forums etc. More so, the game run via iTGB.

Just wondering if anyone has any ideas on how to trouble shoot this, or what the problem might be.


From the console:
2DGame.app/game/scripts/behaviors/timeScaleBtn.cs. Took 1 ms
(gdb)



The timeScaleBtn.cs is no longer a file with in the project. It was a month ago. My project has run fine up until now.

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
05/03/2011 (2:43 pm)
Further on this. I am just wondering, if I create a project with an iOS in XCode that is/was previous to either A. the current version of XCode or that that is on my device, could that cause a (gdb) crash?
#2
05/10/2011 (8:30 pm)
If anyone can help me trouble shoot this I would be obliged.

Most recently...
1. My project will load on one device, but not another. Both have valid and identical provision profiles.
2. The last line in console before crash is for a non existent behavior
3. When it loads on to the one device it crashes when I load a particular (main) game play level (obviously many possible reasons) It took 1112 ms for the level that it crashes on to load. I have removed many objects that were deemed to big for the device, removed filter pads etc.
4. I posted in pasteBin (link: http://pastebin.com/KYNzmBen). One very interesting this is that on lines 121 thru 141 it is reference to material from my a completely different project that is no longer in my MyProjects folder. (???)

These are the main issues I have found. If anyone has any potential insight, suggestions, please pass them along.

Thanks.




#3
05/11/2011 (2:48 am)
Rennie

What I usually do is to set up some breakpoints in XCode. That way one can trace every code execution step by step, and see where it's failing. Also the best way to learn what the engine is actually doing. Hope that helps.
#4
05/11/2011 (3:25 am)
So is that a matter of simply pressing the breakpoint button and reading the console output? And thanks. Will actually do in a few hours.
#5
05/11/2011 (9:37 am)
I came across an video on youtube of a guy showing how to use global breakpoints. Seems easy enough, however, he is using an older version of XCode and in that version, he goes to the "Run" Menu and selects "Show Breakpoints". Niether of those exist in this XCode (4.something).


Also, how do you set the project to Debug Mode? There use to be an obvious button, now.. not so much. I looked in the Build Settings, but was unsure as to mess with the settings. Seemed many of the debug settings might be for shipping. (?)


: Unsure what to make of it. thanks.
#6
05/11/2011 (11:01 am)
here's a good resource

developer.apple.com/library/mac/#documentation/IDEs/Conceptual/Xcode4TransitionG...

To use breakpoints, in XCode 4:

1) Open a project and click on the icon in the top left that looks like a folder (below the "Run" button). At the top right there are 7 buttons that control which windows are opened, you will want the tree on the right, debug output in the bottom opened.

2) In the TGB engine navigate to the folder "platformiPhone", and to the file "iPhoneMain.mm". Clicking once in the file name in the tree opens another window with the file. Then look in this file for a function called "main". With the mouse click at the very left of the function call "printf". You will see that a blue mark just showed up at the line you clicked. That's a breakpoint :-)

3) To debug: click the "Run" button. XCode will stop execution of the program at that line. At the Debug window toolbar (lower window) there are some icons that control how to debug. You will have to press each one of them depending what you need
a) step: goes each line of code step by step
b) step into: goes inside a function
3) step out: goes outside a function

Now, if your code is mostly in script, debugging with Xcode might not be that obvious to find out the place where the error happens.

In that case, you'll have to use a script debugger, Torsion for example. Myself I always use both at the same time.
#7
05/11/2011 (12:10 pm)
Thank you Pedro.
I will go over this in a bit.

Cheers!

:::)))(((
#8
05/11/2011 (5:48 pm)
Thanks Pedro.
So I went over your steps, and without difficulty I got to the beginning of step 3). Run. Did that. However, I am unsure what the "Debug window toolbar" is, or where. Thus I could not follow the rest.


I am about to go over the docs you supplied but can I ask... Why did you chose the point you did as the breakpoint?




Thanks again.
Ren
#9
05/11/2011 (7:31 pm)
Hi Rennie

You're welcome, glad I could help.

The Debug window toolbar is shown in this link. Search for Figure 5.10

developer.apple.com/library/mac/#documentation/IDEs/Conceptual/Xcode4TransitionG...

To show it there is a button at top right that has a tooltip that says "Hide or show the Debug Area".

That point is the initial program execution, every C/C++ program starts in a function called "main", so I thought you might as well start at the beginning :-)

At some point in the code execution the engine processes all the script .cs files, so look for that, and see if it's trying to load that file from the initial report.
#10
05/12/2011 (2:39 pm)
Thanks Pedro. Havent had a chance to go over this yet. Hopefully tonight.
Cheers.





BUr do you think, in theory, as I have been looking in the console, as to where the behaviors are being called from. I can not see, as it usually starts with "tourqueGame", not "Applications/...".


:?
#11
05/13/2011 (7:42 am)
Hi Pedro.
I tried to set up breakpoints in my own bevaiors, but am not able to do so. Since, it seems I must go into the engine I have no idea what to do. What file to use, and at what point. So for now, I am again!!!!, going to reinstall XCode, create a new project and just, piece by pice copy it over. Hopefully I can find the bad file (?) that way.


Cheers.