public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "zelenski at cs dot stanford.edu" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug sim/31915] New: gdb sim for riscv mishandle breakpoints, skips original instruction under ebreak Date: Thu, 20 Jun 2024 01:17:21 +0000 [thread overview] Message-ID: <bug-31915-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=31915 Bug ID: 31915 Summary: gdb sim for riscv mishandle breakpoints, skips original instruction under ebreak Product: gdb Version: 14.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: sim Assignee: unassigned at sourceware dot org Reporter: zelenski at cs dot stanford.edu CC: vapier at gentoo dot org Target Milestone: --- Created attachment 15585 --> https://sourceware.org/bugzilla/attachment.cgi?id=15585&action=edit Script show broken gdb and fixed version gdb sim debugging bare-metal riscv program. Set breakpoint at address 0xblah. When breakpoint is hit, the original instruction at address 0xblah is skipped. I believe this is due to ebreak overwrite at 0xblah. When hit ebreak, expected handling would restore the original at 0xblah and reissue instruction, but sim mistakenly advances to 0xblah+4 which skips execution of original. This bug in simulator seems to affect any use of breakpoints (severity of consequences vary based on content of skipped instruction) Excerpt from sim/riscv/sim-main.c below. Edit line 628 to remove the "+4" seems to correct problem. 625 case MATCH_EBREAK: 626 TRACE_INSN (cpu, "ebreak;"); 627 /* GDB expects us to step over EBREAK. */ 628 sim_engine_halt (sd, cpu, NULL, riscv_cpu->pc+4, sim_stopped, 629 SIM_SIGTRAP); 630 break; Attachment shows gdb skipping instruction at breakpoint and again with above fix applied showing that instruction is correctly executed -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2024-06-20 1:17 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-20 1:17 zelenski at cs dot stanford.edu [this message] 2024-06-20 1:17 ` [Bug sim/31915] " zelenski at cs dot stanford.edu 2024-06-20 1:34 ` zelenski at cs dot stanford.edu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-31915-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).