public inbox for
help / color / mirror / Atom feed
From: Tom de Vries <>
Subject: [binutils-gdb] [gdb/tdep] Handle pipe2 syscall for amd64
Date: Mon,  9 May 2022 08:42:20 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=cd02db09d26959ea58771c946b44e56fe8c0d36e

commit cd02db09d26959ea58771c946b44e56fe8c0d36e
Author: Tom de Vries <>
Date:   Mon May 9 10:42:16 2022 +0200

    [gdb/tdep] Handle pipe2 syscall for amd64
    When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
    I run into:
    (gdb) continue^M
    Process record and replay target doesn't support syscall number 293^M
    Process record: failed to record execution log.^M
    Program stopped.^M
    0x00007ffff7daabdb in pipe () from /lib64/^M
    (gdb) FAIL: gdb.reverse/pipe-reverse.exp: continue to breakpoint: marker2
    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.
    There is already support added for syscall pipe2 for aarch64 (which only has
    syscall pipe2, not syscall pipe), so enable the same for amd64, by:
    - adding amd64_sys_pipe2 in enum amd64_syscall
    - translating amd64_sys_pipe2 to gdb_sys_pipe2 in amd64_canonicalize_syscall
    Tested on x86_64-linux, specifically on:
    - openSUSE Tumbleweed (with glibc 2.35), and
    - openSUSE Leap 15.3 (with glibc 2.31).

 gdb/amd64-linux-tdep.c | 3 +++
 gdb/amd64-linux-tdep.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 0e5194fbeee..9a0759d639c 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -460,6 +460,9 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
   case amd64_x32_sys_pipe:
     return gdb_sys_pipe;
+  case amd64_sys_pipe2:
+    return gdb_sys_pipe2;
   case amd64_sys_select:
   case amd64_x32_sys_select:
     return gdb_sys_select;
diff --git a/gdb/amd64-linux-tdep.h b/gdb/amd64-linux-tdep.h
index 4a41b3b8245..184b0c86f07 100644
--- a/gdb/amd64-linux-tdep.h
+++ b/gdb/amd64-linux-tdep.h
@@ -320,6 +320,7 @@ enum amd64_syscall {
   amd64_sys_sync_file_range = 277,
   amd64_sys_vmsplice = 278,
   amd64_sys_move_pages = 279,
+  amd64_sys_pipe2 = 293
 /* Enum that defines the syscall identifiers for x32 linux.

                 reply	other threads:[~2022-05-09  8:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \

* 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).