Normally, after compiling and downloading the program to our robot, the debugger starts immediately. However, ever since the last update, even after the debugger panel opens and we start our program, no variables or values are displayed under either global variables or local variables. What can I do to get the debugger working again?

Tue Oct 09, 2012 6:48 pm

JohnWatson

Site Admin

Joined: Thu May 24, 2012 12:15 pmPosts: 722

Re: Debugger Is Blank

The reason the Local Variables debug window isn't showing the local variables is because when the code running in a non-suspended state (running in real time), it's difficult to know which local variables (on stack) are valid at any given time. This is inline with all modern IDE's. You can, however, view the values of the variables if you suspend the program (using the Debugger window).

Alternatively, you can view the values in real time by making the variables global (which bypasses the problem of the IDE having to guess at which variables are valid at any point in time). You can also use the Debug Stream debugger window coupled with the 'writeDebugStream' commands to monitor multiple variables in the program.

For example, take a look at the following code. Integers a, b, and c can be viewed at any point because they are global; x, y, and z however, will show their values when the program is suspended. The variable 'z' is having its value printed to the Debug Stream debugger window using the 'writeDebugStreamLine' command, with a 50 millisecond pause to ensure the Debugger Stream window has enough time to write each value:

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum