From: Vincent Chen <vincent.chen@sifive.com>
To: gdb@sourceware.org
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Subject: RISC-V: Is it reasonable to extend current target_description for KGDB?
Date: Tue, 15 Oct 2019 07:43:00 -0000 [thread overview]
Message-ID: <CABvJ_xgKbD_EUQKqWcr9crNL-XmWv704xPSy1xjZvZzEODEo9Q@mail.gmail.com> (raw)
Hi,
I am a Linux developer and trying to add the KGDB support to the
RISC-V Linux. During the porting, I encountered a GDB issue with the
'g' packet. I hope the GDB experts can give me some advice.
The KGDB is a debugger provided by the kernel for users to debug
kernel space through GDB. To parse the GDB packets, the KGDB has a
simple gdb stub. However, this gdb stub does not support the
"qSupported" packet. In this case, GDB does not know the register
configuration on the remote target. From the gdb remote debugging
messages, I guess GDB will assume that the remote target only supports
x0~x31 plus pc registers. This will cause GDB not to query the remote
target about the content of the specified register by sending a "p"
packet If the specified register does not belong to the register list
of the "g" packet. In other words, GDB only can get the information of
x0~x31 plus pc registers from KGDB.
One way to solve this problem may be to add 'qSupported' packet
support to the KGDB's gdb stub. However, I think this may be a bit
inappropriate because the KGDB in RISC-V only reports 36 registers,
namely 32 GPRs, $PC, $sstatus, $sbadaddr and $scause. Therefore, from
the viewpoint of KGDB, if the register list of the 'p' packet can
include these 36 registers, the complex implementation for the
register query flow will be unnecessary. In fact, I found that other
architectures (such as ARM, ARM64, and PowerPC) make the register list
of the 'p' packet include all reported registers. However, I am not
familiar with GDB, and I don't know if the current GDB implementation
has some limitations or points to note about achieving this feature.
Therefore, I would be grateful if anyone could give me any advice or
would like to implement it.
Thanks
Best regards
Vincent Chen
next reply other threads:[~2019-10-15 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 7:43 Vincent Chen [this message]
2019-10-15 19:53 ` Jim Wilson
2019-10-16 13:21 ` Maciej W. Rozycki
2019-10-16 10:03 ` Pedro Alves
2019-10-16 13:17 ` Maciej W. Rozycki
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=CABvJ_xgKbD_EUQKqWcr9crNL-XmWv704xPSy1xjZvZzEODEo9Q@mail.gmail.com \
--to=vincent.chen@sifive.com \
--cc=gdb@sourceware.org \
--cc=paul.walmsley@sifive.com \
/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