From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simon.marchi@polymtl.ca>,
"Ge, Lei" <Lei.Ge@windriver.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Cc: "Xin, Wenyan" <Wenyan.Xin@windriver.com>
Subject: Re: GDB will set bp at a function for RISC-V when step over this function call
Date: Mon, 20 Sep 2021 10:06:04 -0700 [thread overview]
Message-ID: <bd168873-cecb-d738-576e-f3af94497a4a@FreeBSD.org> (raw)
In-Reply-To: <a86e6201-7da7-6ec7-f720-49b3883987fb@polymtl.ca>
On 9/18/21 7:04 PM, Simon Marchi via Gdb wrote:
> On 2021-09-17 3:57 a.m., Ge, Lei wrote:
>> Hi all,
>>
>> I have a question about GDB for RISC-V. When step over a function call, GDB will set a bp at this function only for RISC-V. Do you think it is a bug? Thanks.
>
> Hi,
>
> Probably because RISC-V uses software single step to implement
> single instruction stepping. It implements the
> gdbarch_software_single_step hook:
>
> https://gitlab.com/gnutools/binutils-gdb/-/blob/master/gdb/riscv-tdep.c#L3923-3940
>
> Note that this callback is only installed in riscv_fbsd_init_abi and
> riscv_linux_init_abi, so is only effective when debugging a Linux or
> FreeBSD target. So I suppose that if you were debugging a bare-metal
> application, GDB would use hardware single step instead, not sure if
> that is by design.
RISC-V doesn't (to my knowledge) have support for hardware single step and
should be using software single step on bare metal as well.
--
John Baldwin
next prev parent reply other threads:[~2021-09-20 17:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 7:57 Ge, Lei
2021-09-19 2:04 ` Simon Marchi
2021-09-20 17:06 ` John Baldwin [this message]
2021-09-22 21:48 ` Jim Wilson
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=bd168873-cecb-d738-576e-f3af94497a4a@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=Lei.Ge@windriver.com \
--cc=Wenyan.Xin@windriver.com \
--cc=gdb@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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).