Re: GDB will set bp at a function for RISC-V when step over this function call

Simon Marchi via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
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.

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.