How to use Debugger?

BlitzMax Forums/BlitzMax Beginners Area/How to use Debugger?

Zacho(Posted 2011) [#1]
Something by using your code line-by-line to fix problems and such. How?


Czar Flavius(Posted 2011) [#2]
Put DebugStop command in the code just before the troublesome part. You can put it in an If, to test at a specific time. When you run in debug mode, the program will now halt at this stop. Press the step over, step in (go into function) and step out (go out of function) buttons. You can see the value of current variables.


col(Posted 2011) [#3]
Just to add...
The current variables are on the right hand side of the editor window when the debugger is 'active'.

Make sure you have set the build mode to 'Debug' build if you want to use the debugger features. In standard MaxIDE menus go to Program/Build Options and make sure that Debug Build is ticked.

When you are in Debug Build mode and an error occurs in your program that would normally crash the program ( say you index an array out of bounds, or try to draw an image that isnt loaded correctly ) then the debugger will open at the line thats caused the crash ( bear in mind this isnt necessarily the line that is at fault! ) but you can look into your variables values in the right hand side of the editor to work out why it has happened.

If you're not in Debug Build and you get an error, instead of the debugger, you'll get a crash, which will usually give you an Exception Error with no idea of what has caused it.


Zacho(Posted 2011) [#4]
Awesome!! Thanks guys, this can help me a lot. I am sure glad your smart in this area, I, well that's a different story haha


Czar Flavius(Posted 2011) [#5]
We all were beginners too, learning and asking :) Have fun!