[gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp
authorTom de Vries <tdevries@suse.de>
Mon, 9 May 2022 10:01:42 +0000 (12:01 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 9 May 2022 10:01:42 +0000 (12:01 +0200)
commit5463a15c18bf01ba33bfbdc6739649fe1d00058b
treef80c273d9cdfa49705fff0d6075d129179cea221
parentcd02db09d26959ea58771c946b44e56fe8c0d36e
[gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp

When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
I run into:
...
(gdb) continue^M
Continuing.^M
^M
Catchpoint 2 (returned from syscall pipe2), in pipe () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.base/catch-syscall.exp: without arguments: \
  syscall pipe has returned
...

The current glibc on Tumbleweed is 2.35, which contains commit
"linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
is used instead of syscall pipe.

Fix this by detecting whether syscall pipe or pipe2 is used before running the
tests.

Tested on x86_64-linux, specifically on:
- openSUSE Tumbleweed (with glibc 2.35), and
- openSUSE Leap 15.3 (with glibc 2.31).

On openSUSE Tumbleweed + target board unix/-m32, this exposes:
...
(gdb) catch syscall pipe2^M
Unknown syscall name 'pipe2'.^M
...
which will be fixed in a folllow-up patch.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
gdb/testsuite/gdb.base/catch-syscall.c
gdb/testsuite/gdb.base/catch-syscall.exp