Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Sergio Durigan Junior <sergiodj@redhat.com>
Subject: [PATCH][gdb/tdep] Support catch syscall pipe2 for i386
Date: Thu, 5 May 2022 13:49:03 +0200	[thread overview]
Message-ID: <dfb3d108-de55-3a8f-618f-75e1b3ebe208@suse.de> (raw)
In-Reply-To: <d0415e7a-d90a-705f-719d-2c9dc657750c@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

[ was: Re: [PATCH, v2][gdb/testsuite] Handle pipe2 syscall in 
gdb.base/catch-syscall.exp ]

On 5/5/22 13:47, Tom de Vries wrote:
> On 5/3/22 16:57, Tom de Vries wrote:
>> Hi,
>>
>> 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 in stead 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).
>>
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
>>
>> Any comments?
>>
> 
> I'm submitting a v2.  I found out that with target board unix/-m32, 
> pipe2 is not recognized as syscall name (which I'll fix in a follow-up 
> patch), so I made the test robust against this, by using the syscall 
> number instead.

And this is that follow-up patch.

Any comments?

Thanks,
- Tom

[-- Attachment #2: 0009-gdb-tdep-Support-catch-syscall-pipe2-for-i386.patch --]
[-- Type: text/x-patch, Size: 1585 bytes --]

[gdb/tdep] Support catch syscall pipe2 for i386

With test-case gdb.base/catch-syscall.exp and target board unix/-m32, we run
into:
...
(gdb) catch syscall pipe2^M
Unknown syscall name 'pipe2'.^M
(gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: catch syscall pipe2
...

Fix this by:
- adding a pipe2 entry in gdb/syscalls/i386-linux.xml.in, and
- regenerating gdb/syscalls/i386-linux.xml using
  "xsltproc --output i386-linux.xml apply-defaults.xsl i386-linux.xml.in".

Tested on x86_64-linux with native and unix/-m32.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056

---
 gdb/syscalls/i386-linux.xml    | 1 +
 gdb/syscalls/i386-linux.xml.in | 1 +
 2 files changed, 2 insertions(+)

diff --git a/gdb/syscalls/i386-linux.xml b/gdb/syscalls/i386-linux.xml
index a783dd10af3..4a7a2345186 100644
--- a/gdb/syscalls/i386-linux.xml
+++ b/gdb/syscalls/i386-linux.xml
@@ -334,4 +334,5 @@
   <syscall name="eventfd" number="323" groups="descriptor"/>
   <syscall name="fallocate" number="324" groups="descriptor"/>
   <syscall name="timerfd_settime" number="325" groups="descriptor"/>
+  <syscall name="pipe2" number="331" groups="descriptor"/>
 </syscalls_info>
diff --git a/gdb/syscalls/i386-linux.xml.in b/gdb/syscalls/i386-linux.xml.in
index e778ab54043..13c4d1d99d4 100644
--- a/gdb/syscalls/i386-linux.xml.in
+++ b/gdb/syscalls/i386-linux.xml.in
@@ -337,4 +337,5 @@
   <syscall name="eventfd" number="323"/>
   <syscall name="fallocate" number="324"/>
   <syscall name="timerfd_settime" number="325"/>
+  <syscall name="pipe2" number="331"/>
 </syscalls_info>

  reply	other threads:[~2022-05-05 11:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 14:57 [PATCH][gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp Tom de Vries via Gdb-patches
2022-05-05 11:47 ` [PATCH, v2][gdb/testsuite] " Tom de Vries via Gdb-patches
2022-05-05 11:49   ` Tom de Vries via Gdb-patches [this message]
2022-05-05 13:20     ` [PATCH][gdb/tdep] Support catch syscall pipe2 for i386 Simon Marchi via Gdb-patches
2022-05-09 10:26       ` [PATCH][gdb] Add gdb/syscalls/Makefile Tom de Vries via Gdb-patches
2022-05-09 14:41         ` Simon Marchi via Gdb-patches
2022-05-09 14:46           ` Tom de Vries via Gdb-patches
2022-05-09 10:39       ` [PATCH][gdb] Update syscalls/{amd64,i386}-linux.xml Tom de Vries via Gdb-patches
2022-05-09 14:48         ` Simon Marchi via Gdb-patches
2022-05-09 15:29           ` Tom de Vries via Gdb-patches
2022-05-09 15:40             ` Andreas Schwab
2022-05-09 15:42               ` Tom de Vries via Gdb-patches
2022-05-09 15:45                 ` Andreas Schwab
2022-05-09 16:04                   ` Tom de Vries via Gdb-patches
2022-05-09 17:19         ` Tom Tromey
2022-05-10 11:39           ` Tom de Vries via Gdb-patches
2022-05-12  9:00             ` Tom de Vries via Gdb-patches
2022-05-10 11:53         ` Tom de Vries via Gdb-patches
2022-05-16 16:07           ` Tom Tromey
2022-05-18  9:58             ` [committed][gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh Tom de Vries via Gdb-patches
2022-05-05 13:23   ` [PATCH, v2][gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp Simon Marchi via Gdb-patches
2022-05-09 10:18     ` Tom de Vries via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfb3d108-de55-3a8f-618f-75e1b3ebe208@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox