From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 9258C3858427; Mon, 9 May 2022 08:42:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9258C3858427 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/tdep] Handle pipe2 syscall for amd64 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 2dc60c77108cad22c270cec3f88d01fd20716a35 X-Git-Newrev: cd02db09d26959ea58771c946b44e56fe8c0d36e Message-Id: <20220509084220.9258C3858427@sourceware.org> Date: Mon, 9 May 2022 08:42:20 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2022 08:42:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dcd02db09d269= 59ea58771c946b44e56fe8c0d36e commit cd02db09d26959ea58771c946b44e56fe8c0d36e Author: Tom de Vries Date: Mon May 9 10:42:16 2022 +0200 [gdb/tdep] Handle pipe2 syscall for amd64 =20 When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumblew= eed, I run into: ... (gdb) continue^M Continuing.^M Process record and replay target doesn't support syscall number 293^M Process record: failed to record execution log.^M ^M Program stopped.^M 0x00007ffff7daabdb in pipe () from /lib64/libc.so.6^M (gdb) FAIL: gdb.reverse/pipe-reverse.exp: continue to breakpoint: marke= r2 ... =20 The current glibc on Tumbleweed is 2.35, which contains commit "linux: Implement pipe in terms of __NR_pipe2", and consequently syscal= l pipe2 is used in stead of syscall pipe. =20 There is already support added for syscall pipe2 for aarch64 (which onl= y 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_sy= scall =20 Tested on x86_64-linux, specifically on: - openSUSE Tumbleweed (with glibc 2.35), and - openSUSE Leap 15.3 (with glibc 2.31). =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29056 Diff: --- 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; =20 + 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 =3D 277, amd64_sys_vmsplice =3D 278, amd64_sys_move_pages =3D 279, + amd64_sys_pipe2 =3D 293 }; =20 /* Enum that defines the syscall identifiers for x32 linux.