Sequence of actions leading to the bug ====================================== On Debian testing/amd64: the debugger first complains with "Cannot find user-level thread" and later on stops with internal-error. Could not reproduce yet, keeping the core for some time in case you need more info. $ gdb ./a.out GNU gdb (Debian 7.11.1-2) 7.11.1 [...] (gdb) b [redacted] Breakpoint 1 at 0x406b1f: file [redacted].cpp, line 313. (gdb) r Starting program: /home/yann/shadow/clientsdl/a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [...] [New Thread 0x7fffec510700 (LWP 18200)] [New Thread 0x7fffebd0f700 (LWP 18201)] [New Thread 0x7fffeb50e700 (LWP 18202)] [New Thread 0x7fffead0d700 (LWP 18203)] [Switching to Thread 0x7fffec510700 (LWP 18200)] Thread 2 "..." hit Breakpoint 1, ... 313 { (gdb) n Cannot find user-level thread for LWP 18200: generic error (gdb) [Thread 0x7fffead0d700 (LWP 18203) exited] [Thread 0x7fffeb50e700 (LWP 18202) exited] [Thread 0x7fffebd0f700 (LWP 18201) exited] [Thread 0x7fffec510700 (LWP 18200) exited] [Inferior 1 (process 18193) exited with code 01] The program is not being run. (gdb) The program is not being run. (gdb) [1]+ Stopped gdb ./a.out $ [...] $ fg gdb ./a.out The program is not being run. (gdb) r Starting program: .../a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [...] [New Thread 0x7fffec510700 (LWP 18227)] [New Thread 0x7fffebd0f700 (LWP 18228)] /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:1868: internal-error: wait returned unexpected status 0x100 A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y gdb backtrace ============= (gdb) bt #0 0x00007f8c62df8458 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55 #1 0x00007f8c62df98da in __GI_abort () at abort.c:89 #2 0x000000000069ff76 in dump_core () at /build/gdb-GtCqbH/gdb-7.11.1/gdb/utils.c:561 #3 0x00000000006a2590 in internal_vproblem (problem=problem@entry=0xc38020 <internal_error_problem>, file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=ap@entry=0x7ffd752dfeb0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/utils.c:769 #4 0x00000000006a2659 in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=ap@entry=0x7ffd752dfeb0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/utils.c:795 #5 0x00000000006d7cbf in internal_error (file=file@entry=0x7a7458 "/build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c", line=line@entry=1868, fmt=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/common/errors.c:55 #6 0x00000000004a2b19 in linux_handle_extended_wait (lp=lp@entry=0x222ecf0, status=256, status@entry=198015) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:1868 #7 0x00000000004a7be8 in linux_nat_filter_event (status=<optimized out>, lwpid=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:2912 #8 linux_nat_wait_1 (ops=<optimized out>, target_options=1, ourstatus=0x7ffd752e0470, ptid=...) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:3206 #9 linux_nat_wait (ops=<optimized out>, ptid=..., ourstatus=0x7ffd752e0470, target_options=1) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:3463 #10 0x00000000004accaa in thread_db_wait (ops=<optimized out>, ptid=..., ourstatus=0x7ffd752e0470, options=1) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-thread-db.c:1123 #11 0x00000000005f1d1d in delegate_wait (self=<optimized out>, arg1=..., arg2=<optimized out>, arg3=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/target-delegates.c:116 #12 0x00000000006006c4 in target_wait (ptid=..., status=status@entry=0x7ffd752e0470, options=options@entry=1) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/target.c:2258 #13 0x00000000005b1301 in do_target_wait (ptid=..., status=status@entry=0x7ffd752e0470, options=1) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/infrun.c:3643 #14 0x00000000005bd288 in fetch_inferior_event (client_data=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/infrun.c:3901 #15 0x00000000005d53a8 in inferior_event_handler (event_type=<optimized out>, client_data=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/inf-loop.c:44 #16 0x00000000005d36d5 in gdb_wait_for_event (block=block@entry=0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/event-loop.c:834 #17 0x00000000005d384e in gdb_do_one_event () at /build/gdb-GtCqbH/gdb-7.11.1/gdb/event-loop.c:298 #18 0x00000000005d39be in start_event_loop () at /build/gdb-GtCqbH/gdb-7.11.1/gdb/event-loop.c:347 #19 0x00000000005cd383 in captured_command_loop (data=data@entry=0x0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/main.c:318 #20 0x00000000005ca19d in catch_errors (func=func@entry=0x5cd370 <captured_command_loop>, func_args=func_args@entry=0x0, errstring=errstring@entry=0x7abfeb "", mask=mask@entry=RETURN_MASK_ALL) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/exceptions.c:240 #21 0x00000000005cdf76 in captured_main (data=data@entry=0x7ffd752e07f0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/main.c:1157 #22 0x00000000005ca19d in catch_errors (func=func@entry=0x5cd8d0 <captured_main>, func_args=func_args@entry=0x7ffd752e07f0, errstring=errstring@entry=0x7abfeb "", mask=mask@entry=RETURN_MASK_ALL) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/exceptions.c:240 #23 0x00000000005ce84b in gdb_main (args=args@entry=0x7ffd752e07f0) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/main.c:1165 #24 0x000000000045eca5 in main (argc=<optimized out>, argv=<optimized out>) at /build/gdb-GtCqbH/gdb-7.11.1/gdb/gdb.c:32
Can finally reproduce after a few tries. What happens is that another thread calls exit() while I "next" this thread. Most of the time gdb handles it nicely, but it also happens that I get the internal-error immediately: (gdb) b decodebuffer(Buffer*) Breakpoint 1 at 0x406b1f: file ./src/video_decoder_vaapi[...].cpp, line 313. (gdb) r Starting program: .../a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [...] [New Thread 0x7fffec510700 (LWP 20421)] [New Thread 0x7fffebd0f700 (LWP 20422)] /build/gdb-GtCqbH/gdb-7.11.1/gdb/linux-nat.c:1868: internal-error: wait returned unexpected status 0x100 A problem internal to GDB has been detected,