[PATCH] Handle glibc's thread cancellation signal (SIG32) in gdb.threads/create-fail.exp
Luis Machado
luis.machado@linaro.org
Fri Jan 22 14:00:01 GMT 2021
When I switched to Ubuntu 20.04, I noticed gdb.threads/create-fail.exp started
failing. Instead of running to completion, it always ran into a SIG32 during
the final pthread_create call.
Reading about this a little, it seems SIG32 is used by glibc for thread
cancellation purposes. I'm not sure why this didn't show up in Ubuntu 18.04.
It may be related to the glibc version.
In any case, handle this by making GDB ignore SIG32, but still pass the signal
to the inferior.
With this change, I get full passes for this testcase on aarch64-linux
Ubuntu 20.04 and Ubuntu 18.04.
gdb/testsuite/ChangeLog:
YYYY-MM-DD Luis Machado <luis.machado@linaro.org>
* gdb.threads/create-fail.exp: Handle SIG32.
---
gdb/testsuite/gdb.threads/create-fail.exp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gdb/testsuite/gdb.threads/create-fail.exp b/gdb/testsuite/gdb.threads/create-fail.exp
index 51f3ab0feb4..d5986578fd5 100644
--- a/gdb/testsuite/gdb.threads/create-fail.exp
+++ b/gdb/testsuite/gdb.threads/create-fail.exp
@@ -37,6 +37,14 @@ for {set i 1} {$i <= $iterations} {incr i} {
return -1
}
+ # glibc uses SIG32 for thread cancellation. Make sure GDB does not
+ # try to handle it and that it gets passed to the inferior.
+ gdb_test "handle SIG32 nostop noprint pass" \
+ [multi_line \
+ "Signal Stop\tPrint\tPass to program\tDescription" \
+ "SIG32 No\tNo\tYes\t\tReal-time event 32" ] \
+ "ignore thread cancellation signal"
+
set test "run till end"
gdb_test_multiple "continue" "$test" {
-re "exited with code 01.*$gdb_prompt $" {
--
2.25.1
More information about the Gdb-patches
mailing list