Why GDB crash if create too many threads?

Source: Internet
Author: User

When GDB attach a task, gdb hangs dead if too many threads are created, and the GDB version is upgraded or set to Non-stop mode to resolve the problem.

I fought with similar gdb issues for a while. My case is having lots of threads spawned this 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 FAI LS, it fails with style as in crashes:) I think it tries to attach to a thread that's already done as per the error message.
I See this as a issue in GDB 6.5 to 7.6 and still happening. Did not a try with older versions.
My Advice is a look for this with case or similar. Once I changed my design to has a thread serving a queue of requests gdb works flawlessly.
Design Wise is healthier to has already created threads that digest actions than always spawning new threads.
still same code debugs without a problem on the Visual Studio so I do has to say that was a small disappointment to me wit H regards to GDB.

I use Eclipse and looking at the GDB traces (usually enabled by default) would 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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.