View unanswered posts | View active topics It is currently Thu Sep 18, 2014 7:41 am






Reply to topic  [ 2 posts ] 
Debugger Is Blank 
Author Message
Rookie

Joined: Tue Oct 09, 2012 6:39 pm
Posts: 1
Post Debugger Is Blank
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
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 576
Post 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:

Code:
#pragma DebuggerWindows("Debugstream")

int a=0;
int b=1;
int c=3;

task main()
{
int x, y, z;
x=1;
y=2;
z=3;

while (true)
   {
      x+=1;
      y+=2;
      z+=3;
      writeDebugStreamLine("z is: %d", z);
      wait1Msec(50);
   }
}

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Oct 10, 2012 4:22 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.