Why gdb crash if create too many threads ?

Posted redstar9451

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Why gdb crash if create too many threads ?相关的知识,希望对你有一定的参考价值。

gdb attach task时,如果创建过多线程,gdb会挂死,此时升级gdb版本或设置为non-stop模式可解决此问题。

 

I fought with similar gdb issues for a while. My case was having lots of threads spawned that executed few functions and then exited.
It appears if a thread exits too fast and there‘s lots of these happening sometimes gdb cannot keep up and when it fails, it fails with style as in crashes :) I think it tries to attach to a thread that is already done as per the error message.
I see this as an issue in gdb 6.5 to 7.6 and still happening. Did not try with older versions.
My advice is look for this use case or similar. Once I changed my design to have a thread serving a queue of requests gdb works flawlessly.
Design wise is healthier to have already created threads that digest actions than always spawning new threads.
Still same code debugs without a problem on Visual Studio so I do have to say that is a small disappointment to me with regards to gdb.

I use Eclipse and looking at the GDB traces (usually enabled by default) will give you a better hint of where GDB fails. One of the buttons on the console shows you the GDB trace.

https://stackoverflow.com/questions/16814706/how-does-gdb-attach-to-multi-threaded-process






以上是关于Why gdb crash if create too many threads ?的主要内容,如果未能解决你的问题,请参考以下文章

git 复位出现If no other git process is currently running, this probably means a git process crashed in t

如何在gdb中打印特定条件下的变量?

GDB 调试遇到??的问题

the pitfull way to create a uClinux image including gdb.

利用QEMU+GDB搭建Linux内核调试环境

翻译自mos文章当/var/tmp文件夹被remove掉之后,GI crash,并启动失败,原因是ohasd can not create named pipe