From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C6643858401; Tue, 21 Nov 2023 10:42:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C6643858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1700563338; bh=shzaxpMuL2qz2LdQelTTiwoGkivIze02QJ9JiFrgHYc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XbysDqX3w/OFS85rt/5wxyJPB0WDYGCfFlKFGh/nQZ0pG1R6N2dcMjdrbYlpYB0DT eLzi4fp7SlnieG+ogqLXbNGogubS5J2rGX7MHuP90GpGuEvPpOhNM7YGx0Y7pT9GjO 20bjCY7W4lrNMPT6QV3OGhYV41JdXq3Nvv+/BS/s= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/31071] [gdb/tdep, arm] FAIL: gdb.base/catch-syscall.exp: execve: syscall execve has returned Date: Tue, 21 Nov 2023 10:42:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31071 --- Comment #9 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Deb42bb148956= c283d485bbd182606a851280149d commit eb42bb148956c283d485bbd182606a851280149d Author: Tom de Vries Date: Tue Nov 21 11:44:07 2023 +0100 [gdb/tdep] Fix catching syscall execve exit for arm When running test-case gdb.base/catch-syscall.exp on a pinebook (64-bit aarch64 kernel, 32-bit userland) I run into: ... (gdb) PASS: $exp: execve: syscall(s) execve appears in 'info breakpoint= s' continue^M Continuing.^M ^M Catchpoint 18 (call to syscall execve), 0xf7726318 in execve () from \ /lib/arm-linux-gnueabihf/libc.so.6^M (gdb) PASS: gdb.base/catch-syscall.exp: execve: program has called exec= ve continue^M Continuing.^M process 32392 is executing new program: catch-syscall^M Cannot access memory at address 0xf77c6a7c^M (gdb) FAIL: $exp: execve: syscall execve has returned ... The memory error is thrown by arm_linux_get_syscall_number, when doing: ... /* PC gets incremented before the syscall-stop, so read the previous instruction. */ unsigned long this_instr =3D read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code); ... The reason for the error is that we're stopped at the syscall exit of syscall execve, and the pc is at the first insn of the new exec, which also hap= pens to be the first insn in the code segment, so consequently we cannot read t= he previous insn. Fix this by detecting the situation by looking at the register state, similar to what is done in aarch64_linux_get_syscall_number. Furthermore, catch the memory error by using safe_read_memory_unsigned_integer and return -1 instead, matching the documented behaviour of arm_linux_get_syscall_number. Finally, rather than using a hardcoded constant 11, introduce an ad-hoc arm_sys_execve. Tested on pinebook. PR tdep/31071 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31071 --=20 You are receiving this mail because: You are on the CC list for the bug.=