GDB will set bp at a function for RISC-V when step over this function call
Simon Marchi
simon.marchi@polymtl.ca
Sun Sep 19 02:04:23 GMT 2021
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
More information about the Gdb
mailing list