From: Jim Wilson <jimw@sifive.com>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc: gdb-patches@sourceware.org, Andrew Burgess <andrew.burgess@embecosm.com>
Subject: Re: [PATCH] RISC-V: Don't decrement pc after break.
Date: Mon, 23 Jul 2018 23:27:00 -0000 [thread overview]
Message-ID: <CAFyWVaYnkGdoi0q0cqRxP+qCsEE7B5JnQJM5tCj6SmeuHhoiuQ@mail.gmail.com> (raw)
In-Reply-To: <1830811266.24706.1532366683342.JavaMail.zimbra@embedded-brains.de>
On Mon, Jul 23, 2018 at 10:24 AM, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>> The problem with misa is easy to miss, as gdb only tries to read misa
>> if you execute a command that requires info about the target, such as
>> trying to use hardware floating point. Actually, one of my other
>> patches, the one to remove the pc decrement after a break, modified
>> the code so that we try to read misa when checking to see if
>> compressed breakpoints could be used. Before it was only checking ELF
>> headers for this, which wasn't right. This is probably the patch that
>> exposed the bug in your rtems target support.
>
> This could be also a Qemu bug. I have to check this with the debugger tomorrow. The misa should be returned by Qemu in csr_read_helper() (target/riscv/op_helper.c). A "info registers" for example returns only the standard registers. For the CSR registers I get "not available".
Sorry, I see that you did point at the right patch. I'm on vacation,
and not able to give this my full attention at the moment.
What should happen here is that gdb calls fetch_registers, which then
uses some target specific way to access registers. In the linux
native support, there is a function defined that uses ptrace to read
registers. I don't know what happens in the openocd case. If you are
using target remote, then you are using the fetch_registers call in
remote.c, which means the problem is in the target gdbstub. Looking
at old qemu in riscv-gnu-toolchain, I see in target-riscv/gdbstub.c in
riscv_cpu_gdb_read_register that it only handles the first 65
registers, which are the int, pc, and fp registers. Looking at new
qemu in freedom-u-sdk, I see in target/riscv/gdbstub.c that the
riscv_cpu_gdb_read_register function is handling the csrs, and looks
OK. So maybe the problem is that the qemu you are using is too old?
Jim
next prev parent reply other threads:[~2018-07-23 23:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 0:12 Jim Wilson
2018-07-17 15:37 ` Andrew Burgess
2018-07-23 10:31 ` Sebastian Huber
2018-07-23 15:38 ` Jim Wilson
2018-07-23 17:25 ` Sebastian Huber
2018-07-23 23:27 ` Jim Wilson [this message]
2018-07-24 6:15 ` Sebastian Huber
2018-07-24 11:41 ` Jim Wilson
2018-07-26 6:30 ` Sebastian Huber
2018-08-03 22:05 ` Palmer Dabbelt
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=CAFyWVaYnkGdoi0q0cqRxP+qCsEE7B5JnQJM5tCj6SmeuHhoiuQ@mail.gmail.com \
--to=jimw@sifive.com \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=sebastian.huber@embedded-brains.de \
/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