From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F5843858C66; Thu, 16 Nov 2023 10:07:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F5843858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1700129227; bh=IzGYATutTemZPqQ0THkivJBrDnIt+YbSA4Mmm5jhcsU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qZsvFnlZ2WeFpNwxuyg6GfL0XgAxduB1UCLUir9wLHPeT5HLJ/fCf+Inpralaosrj VeqpQ6gCTrQgCTTvU8TDBXpMJbskFYw62Lcpbtfq5zPHyBYtntUWSdIPZ2VORusxtp sWLqNlHH+1Deo3jpzvHG8eMO/5N1GPXRLXs/6MGg= From: "vries 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: Thu, 16 Nov 2023 10:07:06 +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: vries 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 #4 from Tom de Vries --- This is a basic version of the aarch64 approach: ... diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index dfa816990ff..2afb9a64cab 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -830,6 +830,13 @@ arm_linux_get_syscall_number (struct gdbarch *gdbarch, int is_thumb; ULONGEST svc_number =3D -1; + { + ULONGEST lr =3D -1; + regcache_cooked_read_unsigned (regs, ARM_LR_REGNUM, &lr); + if (lr =3D=3D 0) + return 11; + } + regcache_cooked_read_unsigned (regs, ARM_PC_REGNUM, &pc); regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &cpsr); is_thumb =3D (cpsr & t_bit) !=3D 0; @@ -845,8 +852,12 @@ arm_linux_get_syscall_number (struct gdbarch *gdbarch, /* PC gets incremented before the syscall-stop, so read the previous instruction. */ - unsigned long this_instr =3D=20 - read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code); + unsigned long this_instr; + + ULONGEST val; + if (!safe_read_memory_unsigned_integer (pc - 4, 4, byte_order_for_co= de, &val)) + return -1; + this_instr =3D val; unsigned long svc_operand =3D (0x00ffffff & this_instr); ... It's better to test more registers, but I'm not sure which ones. --=20 You are receiving this mail because: You are on the CC list for the bug.=