Jump to content
  • Advertisement
Sign in to follow this  
LAURENT*

Visual studios 2010 debugger variable doesn't update

This topic is 810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I start debugging my projects I put break point at certain spots to check the behavior of the program. One of my int variables always reads as -1 however this is false because the for loop I used for the keeps running. Does anyone know of a way for me to check the status of variables while my program is running?

Share this post


Link to post
Share on other sites
Advertisement

Language? Some form of printf() or Console.Write()?

 

Note that variables only update on breakpoints. There have been times when this was buggy, but 2010 should be stable. What variable is it and what does your loop look like? 

Share this post


Link to post
Share on other sites

My for loop looks like this. The variable that seem to stay as -1 is Total_Objects. It is a int type object. I used this variable to set a limit for a future for loop.

	for (int a = 0; a < MAX_GAME_OBJECTS ; a++ )
	{
		if(Spirit[a] != NULL)
		{
			if((Spirit[a]->Get_Object_Type() !=  FLOOR) &&(Spirit[a]->Get_Object_Type() !=  ON_SCREEN) && (Spirit[a]->Get_Object_Type() !=  ON_SCREEN_BG))
			{
				if  ( (Spirit[a]->Get_Object_Type() !=  ON_SCREEN_CONFIG))
				{
					Object_Track[Total_Objects] = a;
					Object_Physics[Total_Objects] = Spirit[a]->Get_Gravity_Physics();
					Object_Base[Total_Objects] = Spirit[a]->Get_Y();
					Object_Type[Total_Objects] = Spirit[a]->Get_Object_Type();
					Object_Elevation[Total_Objects] = Spirit[a]->Get_Object_Elevation();

					Total_Objects++;
				}
			}

		}

Share this post


Link to post
Share on other sites

And if you set a breakpoint on the line with Total_Objects++, you hit it and still don't observe a change?

Yes, it show it's value as -1 one but that wouldn't be possible

Share this post


Link to post
Share on other sites

Does other variables get updated? Again, where's Total_Objects declared and initialized? Is there any place in your code where you set it to -1?

Share this post


Link to post
Share on other sites

Does other variables get updated? Again, where's Total_Objects declared and initialized? Is there any place in your code where you set it to -1?

They do. I set up total_objects the same way as the other variables that get updated. It like it ran out of memory to show the value of the variables. This isn't exclusive to "Total_Objects", all new variables aren't showing their values when hitting a break point.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!