From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 289A739730DA; Fri, 4 Dec 2020 15:04:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 289A739730DA From: "shahab.vahedi at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug tdep/27015] New: ARC: "eret" value is collected from the wrong data in register cache Date: Fri, 04 Dec 2020 15:04:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: shahab.vahedi at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:04:11 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27015 Bug ID: 27015 Summary: ARC: "eret" value is collected from the wrong data in register cache Product: gdb Version: HEAD Status: UNCONFIRMED Severity: critical Priority: P2 Component: tdep Assignee: unassigned at sourceware dot org Reporter: shahab.vahedi at gmail dot com Target Milestone: --- Versions affected: HEAD and 10.1 -------------------------------- In collect_register() function of arc-linux-tdep.c, the "eret" (exception return) register value is not being reported correctly. Background: When asked for the "pc" value, we have to update the "eret" register with GDB's STOP_PC. The "eret" instructs the kernel code where to jump back when an instruction has stopped due to a breakpoint. This is how collect_register() is doing so: --------------8<-------------- if (regnum =3D=3D gdbarch_pc_regnum (gdbarch)) regnum =3D ARC_ERET_REGNUM; regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]); -------------->8-------------- Root cause: Although this is using the correct offset (ERET register's), it is also changing the REGNUM itself. Therefore, raw_collect (regnum, ...) is not reading from "pc" anymore. Consequence: This bug affects the "native ARC gdb" badly and causes kernel code to jump to addresses after the breakpoint and not executing the "breakpoint"ed instructions at all. That "native ARC gdb" feature is not upstream yet and is in review at the time of writing [1]. [1] Add native GNU/Linux support for ARC in GDB https://sourceware.org/pipermail/gdb-patches/2020-November/173203.html --=20 You are receiving this mail because: You are on the CC list for the bug.=