Page 1 of 1

Any Debugging tips?

Posted: Fri Jul 20, 2007 1:12 pm
by SunTzu
Does anybody have any debugging tips they'd like to share?

I'm currently using debug() to write in log.txt where the bot is running in the code and what certain variables are.

Posted: Fri Jul 20, 2007 1:30 pm
by guest
I used a window.

Create a JFrame add a text view etc. Maybe even a pause button. Call Show(). ... ight=frame

Posted: Fri Jul 20, 2007 6:36 pm
by Bertrand
Real-time debugging is the best way to debug.

Posted: Sat Jul 21, 2007 11:45 am
by RandomGuy
Bertrand wrote:Real-time debugging is the best way to debug.

Posted: Mon Jul 23, 2007 9:19 am
by SunTzu
Thanks guys, those are real time-savers!

Posted: Mon Jul 23, 2007 1:13 pm
by SunTzu
Is there an easy way to see what the bot is doing besides manually stepping through the code via NetBeans?

I'm looking to fix a bug that occurs very infrequently, and I don't want to simply step through until it occurs.

I usually just let Lux automatically restart the game, and then come back in an hour or so to see if the bot has gotten itself into an endless loop.

Posted: Mon Jul 23, 2007 4:52 pm
by dustin
When you're running the app inside the debugger, there should be a 'pause' button. So you can leave it running, and then 'pause' it once it's inside the infinite loop, and the debugger should show you where in the code it's stuck.

Posted: Mon Jul 23, 2007 5:59 pm
by guest
Or put code in to detect the loop and display a dialog, maybe beep to get your attention, them make use of the pause. That way the machine waits for the dialog doing nothing instead of running full tilt in some loop.

Posted: Tue Jul 24, 2007 10:44 am
by SunTzu
Thanks for the tips everybody!