GDB will set bp at a function for RISC-V when step over this function call
John Baldwin
jhb@FreeBSD.org
Mon Sep 20 17:06:04 GMT 2021
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
More information about the Gdb
mailing list