Hi Andrew, > * Rainer Orth [2019-09-05 14:04:06 +0200]: > >> Quite a number of tests FAIL on Solaris due to a mismatch between >> expected and received messages: the testsuite expects something like >> >> Program received signal SIGABRT, Aborted. >> >> while on Solaris it gets >> >> Thread 2 received signal SIGABRT, Aborted. >> >> For a simple testcase, info threads shows >> >> (gdb) info threads >> Id Target Id Frame >> 1 LWP 1 main () at /vol/src/gnu/gdb/doc/bugs/ua.c:5 >> * 2 Thread 1 (LWP 1) main () at /vol/src/gnu/gdb/doc/bugs/ua.c:5 >> >> I suspect this is due to support for the old pre-Solaris 9 MxN thread >> model where user level threads were mapped to a different set of lwps. >> >> For the moment, I'm dealing with this by allowing both forms of the >> message in the testsuite. The patch is almost completely mechanical, >> with the exception of gdb.base/sigbpt.exp where the introduction of a >> new group in the RE required adjustments in the $expect_out indices. > > I'm a little nervous about just allowing either "Thread" or "Program" > for all tests for all targets. Maybe others will disagree and think > I'm worrying about nothing, but I wonder if we could be more > conservative by adding a support function into lib/gdb.exp that takes > the name of a signal and returns the string we expect from GDB, which > we can then change based on Solaris/non-Solaris. > > I haven't looked through the patch in enough detail to know if there's > any reason why this wouldn't work, so please push back if you think > the idea is unworkable. sorry for letting the ball drop on this one. Only recently did I stumble across it again when looking into a related issue and now I finally understand why Solaris is different here. [Thread starting at https://sourceware.org/ml/gdb-patches/2019-09/msg00050.html] * Consider the following testcase: $ cat selfkill.c #include #include #include #include void * selfkill (void *arg) { kill (getpid (), SIGINT); return NULL; } int main (void) { #ifdef _REENTRANT pthread_t tid; pthread_create (&tid, NULL, selfkill, NULL); pthread_join (tid, NULL); #else selfkill (NULL); #endif return 0; } * Now compile on Solaris 9, both without and with -pthread: $ gcc -o selfkill selfkill.c $ gcc -pthread -o selfkill-mt selfkill.c * Run the identical binaries and versions of gdb (7.11 here) on both Solaris 9 and Solaris 10: $ gdb -q --batch -ex run selfkill{,-mt} ** Solaris 9, selfkill: Program received signal SIGINT, Interrupt. 0xb5d54186 in _libc_kill () from /usr/lib/libc.so.1 ** Solaris 9, selfkill-mt: [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] [New LWP 2 ] [New Thread 2 (LWP 2)] Thread 2 received signal SIGINT, Interrupt. [Switching to Thread 1 (LWP 1)] 0xb5c9fad5 in _lwp_wait () from /usr/lib/libc.so.1 ** Solaris 10, selfkill: [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] Thread 2 received signal SIGINT, Interrupt. [Switching to Thread 1 (LWP 1)] 0xfef0c165 in kill () from /lib/libc.so.1 ** Solaris 10, selfkill-mt: [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] [New LWP 2 ] [New Thread 2 (LWP 2)] Thread 2 received signal SIGINT, Interrupt. [Switching to Thread 1 (LWP 1)] 0xfeedca05 in __lwp_wait () from /lib/libc.so.1 ** Trying the same on Linux/x86_64, one sees the same behaviour as on Solaris 9: non-threaded and threaded programs behave differently. * As you can see, on Solaris 10 even the not explicitly threaded version of the test is shown as threaded, explaining the difference in the "... received signal" messages. This is a consequence of the Thread Model Unification Project in Solaris 10, which removed the difference between non-threaded and threaded processes. This has nothing to do with the removal of the pre-Solaris 9 MxN multilevel thread model as I'd originally suspected. That said, I've reworked the patch to use a support function in gdb.exp (signal_recv_msg) to hide the difference between the Solaris and non-Solaris cases. One could think about introducing an additional arg (threaded) so both the explicitly threaded and other cases could be handled similarly. So far lightly tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University