Visual studios 2010 debugger variable doesn't update

Started by
16 comments, last by LAURENT* 7 years, 6 months ago

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?

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?

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++;
				}
			}

		}

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

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

Is it a local? Where is it declared and initialized?

Are you debugging a Debug build or a Release build?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I don't know. Debug

Are you debugging a Debug build or a Release build?

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?

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.

This topic is closed to new replies.

Advertisement