Epic technology fail it is! Today's fail makes for a short post, but that doesn't make it any less annoying.
I wanted to help debug a colleague's program at work recently to try and track down a threading issue (I suspected one thread of freeing memory being used by another thread). Since this program runs on Linux, this unfortunately means using gdb. So I fire up gdb, tell it to run the program, and am greeted by something like this:
linux-nat.c:546: internal-error: wait returned unexpected status 0x100 A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n)
Yes, that's the debugger crashing. That's not supposed to happen.
Some searching threw up this bug from oh, about 4 years ago, as being the most likely cause. Now, the title of this bug implies that you should only see this if you have on the order of seven thousand threads, which is such a ridiculously large number that you'd never expect to run into it. It also suggests that even then this bug only happens occasionally.
Except the program we were trying to debug had a grand total of 4 threads. And gdb would reliably crash whenever I tried to run that program. At which point I was rather stuck, because while there's a whole bunch of debuggers available for Linux (off the top of my head I can think of ddd, Eclipse, or KDbg), what they all are is actually just a frontend for gdb. In the end we worked round it by adding lots of logging, waiting for it to crash, and then puzzling through the pieces, but that was a lot of hassle I could have done without.