Debug Problems

BlitzMax Forums/BlitzMax Programming/Debug Problems

mothmanbr(Posted 2009) [#1]
Hi,

My beta-tester is reporting random crashes when using a powerup which I cannot replicate. Since said beta-tester lives so far away, I can't really go there and watch him play.

So my question is, can I make my game save the crash report to a file so I can see what exactly the error is? I've triple-checked every piece of code relating to the powerup and I can not find anything that would cause such a crash.

By sending him a debug build, the game freezes instead of crashing. Anyway I can see the output from the build?

Thanks in advance.


GfK(Posted 2009) [#2]
What do you mean by "crashing"?

All you can really do is put debug info into a text file while the game is running, and get him to send you that. But ideally your tester needs to investigate the problem and pin it down to a specific cause.

Alternatively, you could watch him play if you go on MSN and use Remote Assistance.


jkrankie(Posted 2009) [#3]
it's a runtime error that's causing the problems, so maybe check any arrays aren't trying to go out of bounds. Also, if you're using built in sound commands, have your friend play with sounds turned off and see if that helps.

Cheers
Charlie


SLotman(Posted 2009) [#4]
Save everything you can to a log file. Something like:

"executed this piece of code"
"executed that piece of code"
"executed piece of code 3"

Do that a LOT. Do it on every line when you processing the power-up.

Ask the tester to send you the file, after the game crashes. At least you will be able to check exactly on each line the game crashes that way - which should give you some information about the problem.


mothmanbr(Posted 2009) [#5]
Yeah I was afraid I was going to have to use a debug log. That will be a pain to implement at this stage.

Thanks though :)


TaskMaster(Posted 2009) [#6]
Make sure you close the file after every write to the log. If your program crashes while the file is open, it may not get written.


Muttley(Posted 2009) [#7]
@mothmanbr: You could give my Log File Handler module a go to help with the logging.

Available here: http://code.google.com/p/muttmod/downloads/list


Volker(Posted 2009) [#8]
Send your beta-tester a release build and use the HandleGeneralError-function from Grey Alien here:
Click here!
This should notify the user about the error.


Brucey(Posted 2009) [#9]
Actually, what we need is a little Launcher app which effectively runs as a tiny Debugger - in that it can catch the exception, and dump all the debug scope variables etc to a file, then close nicely.

Any volunteers? :-)


mothmanbr(Posted 2009) [#10]
@TaskMaster: Thanks for the tip, I wasn't aware of that.

@Muttley: Thanks, I'll check it out. I've programmed my own module for that a year ago when I was still a beginner :)

@Volker: I've checked the code, but does that imply I should program everything inside a try/catch block? :X

@Brucey: That would be ideal :)


Muttley(Posted 2009) [#11]
@TaskMaster: You can actually just call FlushStream after writing a line to prevent that. Will probably be cheaper than closing and opening the file for each write.


TaskMaster(Posted 2009) [#12]
Muttley, interesting. Are you sure that is fool proof against a crashing program? If so, then I need to add it to my own logging class.


Muttley(Posted 2009) [#13]
Seems to be fool proof. I added it after I got fed up losing log entries when my stuff crashed, and haven't had any issues since.


Volker(Posted 2009) [#14]
I've checked the code, but does that imply I should program everything inside a try/catch block? :X

Just put your mainloop inside it.
Try    ' error handling
	 Yourgamestate.start() ' or "Game.run" or whatever you want

	 Catch o:Object
	 HandleGeneralError(o)
End Try

Then your complete code is running inside it.
No need to change anyting else in your program.


mothmanbr(Posted 2009) [#15]
I see. Thanks Volker.