From: Changbin Du <changbin.du@gmail.com>
To: gdb-patches@sourceware.org
Cc: Changbin Du <changbin.du@gmail.com>
Subject: [PATCH] gdb/riscv: fix creating breakpoints at invalid addresses
Date: Thu, 25 Mar 2021 08:47:57 +0000 [thread overview]
Message-ID: <20210325084757.32077-1-changbin.du@gmail.com> (raw)
To allow breakpoints to be created at invalid addresses,
target_read_code() is used instead of read_code(). The
original read_code() should be removed, otherwise the
breakpoint command will fail.
(gdb) hbreak setup_arch
Cannot access memory at address 0xffffffe000c036ac
gdb/ChangeLog:
2021-03-24 Changbin Du <changbin.du@gmail.com>
* riscv-tdep.c (riscv_breakpoint_kind_from_pc): Update.
---
gdb/ChangeLog | 4 ++++
gdb/riscv-tdep.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a548c58e8f72..a84299a2cc38 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-25 Changbin Du <changbin.du@gmail.com>
+
+ * riscv-tdep.c (riscv_breakpoint_kind_from_pc): Update.
+
2021-03-24 Simon Marchi <simon.marchi@polymtl.ca>
* target.h (current_top_target): Remove, make callers use the
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index ca3efaf71cf8..c17839968465 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -706,7 +706,6 @@ riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
user. */
if (target_read_code (*pcptr, buf, 1) == -1)
buf[0] = 0;
- read_code (*pcptr, buf, 1);
}
if (riscv_debug_breakpoints)
--
2.27.0
next reply other threads:[~2021-03-25 8:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 8:47 Changbin Du [this message]
2021-03-25 9:17 ` Andrew Burgess
2021-03-25 9:39 ` Changbin Du
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=20210325084757.32077-1-changbin.du@gmail.com \
--to=changbin.du@gmail.com \
--cc=gdb-patches@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: link
Be 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).