开发者

stepping through program with debugger takes a long time

开发者 https://www.devze.com 2023-01-22 18:36 出处:网络
When I debug my program by stepping through it, it sometimes takes a long time for the step to finish.This was not happening in the beginning of the project so most likely it is due to something I hav

When I debug my program by stepping through it, it sometimes takes a long time for the step to finish. This was not happening in the beginning of the project so most likely it is due to something I have added. Could you give me pointers as to how to remedy this. I did notice one of the problems was due to the main thread trying to paint a widget. My application is multi-threaded (1 background thread and 1 main开发者_JAVA百科 thread) so I am wondering if it has something to do with that. Your comments are appreciated.


With gdb just set scheduler-locking mode to desired behaviour.

In this case: "The step mode optimizes for single-stepping. It stops other threads from "seizing the prompt" by preempting the current thread while you are stepping. Other threads will only rarely (or never) get a chance to run when you step."


A guess: Is your "background thread" pegged at near 100% CPU utilization?

Between lines of of your main thread, while stepping, the debugger is going to allow the background thread to also "step". If the background thread is pegged it can be running a lot more than a few instructions, causing things to appear unresponsive.

Probably if your second thread is doing that much computation continuously it indicates you've got another problem in your application that you need to fix. If you get that thread under control you will probably see your debugger handling things a lot better.


I asked a very similar question regarding visual studio: VS2010 debugger takes an unreasonable amount of time

No real answer came about. You'll find similar questions for past versions of the IDE here as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消