From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6ED993857403; Fri, 1 Oct 2021 19:48:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ED993857403 From: "wilson at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/28371] gdb: watchpoint for local variable doesn't work on RISC-V Date: Fri, 01 Oct 2021 19:48:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wilson 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: cf_reconfirmed_on everconfirmed bug_status 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 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, 01 Oct 2021 19:48:41 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28371 Jim Wilson changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-10-01 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #13 from Jim Wilson --- This line .cfi_def_cfa sp, -32 is wrong. It should instead be .cfi_def_cfa sp, 32 This is emitted after loading the frame pointer from the stack. Before that load, the frame is fp (s0) relative at an offset of 0, because fp is sp+32.= =20 After the frame pointer is destroyed, we need an sp based frame, which is sp and an offset of 32. Compare with the gcc output which has ld s0,24(sp) .cfi_restore 8 .cfi_def_cfa 2, 32 and note that sp is x2 and s0/fp is x8. And I would second Andreas's recommendation to test this by single stepping through the function epilogue and checking the frame. You should be able t= o go up and print the value of q. Also the ".cfi_restore s0" in the clang output doesn't come immediately aft= er the load, but that looks harmless, as both the in register and the on stack values are the same until the function exits, so it shouldn't matter exactly where this line is as long as it comes before the "addi sp,sp,32" since the stack could be clobbered by a signal after that point. --=20 You are receiving this mail because: You are on the CC list for the bug.=