Advertisement Jump to content
Sign in to follow this  
The C modest god

Debugging question

This topic is 4888 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

I have found a bug of an infinite loop in my code. So I fixed it. However, what bothers me is that when I did go in debug mode and then did break. The call stack showed that I was in KERNEL and INPUT8 instead inside the problematic loop. Why does that happen? Is it because of the alt tabbing to go to visual and do the break? Why this happen?

Share this post


Link to post
Share on other sites
Advertisement
It's probably because those functions are called from the infine loop, imagine:



void Draw()
{
SetMatrices();
}
void SetMatrices()
{
VectorStuff();
VectorToMatrix();
}
void VectorStuff(){}
void VectorToMatrix(){}
int main()
{
while(true)
{
Draw();
}
return 0;
}



When you break you might be in VectorToMatrix since the calls go like this;
main->Draw->SetMatrices->VectorToMatrix
You should be able to "jump" down and see what is happening in the main loop by using the callstack, for example if it looks like this:
VectorToMatrix
SetMatrices
Draw
main

You should be able to double-click main and know you are in the loop. At least this is how it works in MSVC7.1

Share this post


Link to post
Share on other sites
You probably broke into the wrong thread. Go to the 'threads' debugger window and you can choose which thread you wish to view the callstack for.

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!