I'm seeing failures in the gdb test gdb.compile/compile-cplus-anonymous.exp when run, with glibc debuginfo installed, on Fedora releases ranging from Fedora 29 thru 37 (and rawhide, currently numbered 38 too). I also see these failures on Ubuntu 22.04 LTS once a missing symlink is installed for libcc1.so. To reproduce this problem on Fedora, do (as root or using sudo): [root@f36-1 gdb]# debuginfo-install -y glibc Then, using a recent (or even old) build of upstream gdb, while in the gdb directory (where the 'gdb' executable is found), do: make check TESTS=gdb.compile/compile-cplus-anonymous.exp I see the following failures / summary: FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code anon_e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code anon_e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print anon_e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code anon_u.aa (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code anon_u.aa (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print anon_u.aa (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.u.b (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.u.b (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print a.u.b (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.s.len (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.s.len (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print a.s.len (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print a.e (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code (*a.s.ptr != 'h') (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code (*a.s.ptr != 'h') (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print (*a.s.ptr != 'h') (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code A::BB (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code A::BB (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print A::BB (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code ABC (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code ABC (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print ABC (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code DEF (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code DEF (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print DEF (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code GHI (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code GHI (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print GHI (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code JKL (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code JKL (timeout) FAIL: gdb.compile/compile-cplus-anonymous.exp: compile print JKL (timeout) === gdb Summary === # of expected passes 1 # of unexpected failures 33 # of known failures 12 On Fedora, glibc debuginfo can be removed as follows: [root@f36-1 gdb]# dnf remove -y glibc-debuginfo Running gdb.compile/compile-cplus-anonymous.exp with glibc debuginfo NOT installed shows this summary: === gdb Summary === # of expected passes 34 # of known failures 12 Testing an upstream build of GDB on Ubuntu 22.04 LTS shows: # of untested testcases 1 I found that libcc1.so was missing. So, I did: root@u2204-1:~# cd /usr/lib/x86_64-linux-gnu/ root@u2204-1:/usr/lib/x86_64-linux-gnu# ln -sn libcc1.so.0 libcc1.so With that symlink in place, I see the following failures / summary on Ubuntu 22.04 LTS: FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code anon_e FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code anon_e FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code anon_u.aa FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code anon_u.aa FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.u.b FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.u.b FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.s.len FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.s.len FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code a.e FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code a.e FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code (*a.s.ptr != 'h') FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code (*a.s.ptr != 'h') FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code A::BB FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code A::BB FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code ABC FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code ABC FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code DEF FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code DEF FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code GHI FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code GHI FAIL: gdb.compile/compile-cplus-anonymous.exp: compile code JKL FAIL: gdb.compile/compile-cplus-anonymous.exp: result of compile code JKL === gdb Summary === # of expected passes 12 # of unexpected failures 22 # of known failures 12 Back on Fedora, if I run the initial part of the test by hand, without glibc debuginfo installed AND without debuginfod, I see: [kev@f36-1 gdb]$ ./gdb -q testsuite/outputs/gdb.compile/compile-cplus-anonymous/compile-cplus-anonymous Reading symbols from testsuite/outputs/gdb.compile/compile-cplus-anonymous/compile-cplus-anonymous... (gdb) set debuginfod enabled off (gdb) set height 0 (gdb) set width 0 (gdb) break -qualified main Breakpoint 1 at 0x401145: file /ironwood1/sourceware-git/f36-master/bld/../../worktree-master/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc, line 71. (gdb) run Starting program: /mesquite2/sourceware-git/f36-master/bld/gdb/testsuite/outputs/gdb.compile/compile-cplus-anonymous/compile-cplus-anonymous [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, main () at /ironwood1/sourceware-git/f36-master/bld/../../worktree-master/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc:71 71 A a; (gdb) compile code -- ; (gdb) break 75 Breakpoint 2 at 0x401165: file /ironwood1/sourceware-git/f36-master/bld/../../worktree-master/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc, line 75. (gdb) continue Continuing. Breakpoint 2, main () at /ironwood1/sourceware-git/f36-master/bld/../../worktree-master/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc:75 75 + static_cast<int> (anon_e) + anon_u.bb + anon_s.len; // break here (gdb) compile code var = anon_e (gdb) I.e. 'compile code var = anon_e' works as expected. Enabling debuginfod (but still without glibc debuginfo installed system-wide) shows the following behavior: (gdb) set debuginfod enabled on ... [same commands and similar output shown above] (gdb) compile code var = anon_e *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_PRE_GENERICIZE | libcp1plugin PLUGIN_GGC_MARKING | libcp1plugin PLUGIN_PRAGMAS | libcp1plugin gdb command line:1:1: internal compiler error: in plugin_start_enum_type, at libcc1/libcp1plugin.cc:1782 Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. GDB is hung at this point, but Ctrl-C returns the user to the GDB prompt. This explains the (many) timeouts that I see on Fedora. I see this same behavior when I disable debuginfod, but have glibc debuginfo installed via the 'debuginfo-install glibc' command shown earlier. In the interest of brevity (!), I won't paste that nearly identical output. (The part that's different is the use of 'set debuginfod enabled off') On Ubuntu 22.04 LTS, when running the test by hand, without debuginfod, but with the libcc1.so symlink fixed as mentioned earlier, I see: (gdb) set debuginfod enabled off ... [snipped session which is largely the same as that shown for Fedora] (gdb) compile code var = anon_e *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_PRE_GENERICIZE | libcp1plugin PLUGIN_GGC_MARKING | libcp1plugin PLUGIN_PRAGMAS | libcp1plugin gdb command line:1:1: internal compiler error: in plugin_start_enum_type, at libcc1/libcp1plugin.cc:1937 0x7fd261edbd8f __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 0x7fd261edbe3f __libc_start_main_impl ../csu/libc-start.c:392 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions. Compilation failed. (gdb) The main difference when running this on Ubuntu is that, after printing out the messages related to the internal compiler error, GDB does not hang, but instead prints "Compilation failed.", returning to the GDB prompt. This explains the difference between the number of failures shown for Ubuntu versus Fedora. On Fedora, the remaining tests failed due to the timeout. On Ubuntu, some gdb tests succeeded; those which attempt to 'compile' something else fail.
I've run into this recently. Looking into it, I see that the gdb plugin can hang while waiting for results from gcc. This happens due in a select() call... this is unfortunate, to say the least. I'm also disappointed in my past self because there doesn't seem to be any sort of sensible error-reporting system in the gdb plugin. That is, if a call fails, gdb will never really know about it, but instead will happily continue trying to exercise the API using nonsense :( Meanwhile I do at least have a workaround for the test suite timeouts. These have been a real pain.
https://sourceware.org/pipermail/gdb-patches/2022-November/194367.html
The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9a7fde04ca4232d4b2efed61486fff65e83ab3a2 commit 9a7fde04ca4232d4b2efed61486fff65e83ab3a2 Author: Tom Tromey <tromey@adacore.com> Date: Wed Nov 30 11:27:10 2022 -0700 Avoid timeouts in gdb.compile PR compile/29541 points out that some of the C++ tests in gdb.compile will time out when the glibc debuginfo is installed. This was interfering with my hacking on gdb by making test runs extremely long, so I looked into it. Internally the bug seems to be that gdb tries to convert multiple symbols named "var" via the compiler interface; one such symbol (I didn't track it down too far) causes the C++ compiler plugin to crash. Unfortunately, the crash is reported as a timeout, as the gdb side of the plugin simply hangs. This seems like a bug in the plugin RPC mechanism and, worse, apparently when I wrote this stuff I didn't really consider error reporting very much at all, so gdb can't really detect failures in the first place. Anyway... this patch works around the timeout by compiling a simple test that should provoke this bug, and then using "untested" if it notices a GCC crash. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29541