Home > Software design >  In debug, when the app is frozen, how to know where the main thread is blocked?
In debug, when the app is frozen, how to know where the main thread is blocked?

Time:08-10

When I debug, sometimes my app start to freeze for unknown reason. How can I know where in my code the main thread is blocked?

I try to pause the app but then I can only access the CPU view that does not help me.

CodePudding user response:

When you pause, you can view the Call Stack window by opening it at View -> Debug Windows -> Call Stack.

The list will show where you are at the top, and all of the key calls that got you there below it.

Call Stack

If you are stuck in the CPU code, and want to see why, follow the list down until you get to some aspect of your program or the libraries and find a good place to put a breakpoint so you can step through the next run. You can get the file to open by double clicking on any of the items in the list that have a blue button. Grey circles usually end up in compiled code that means little to the beginner.

  • Related