public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: "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: Sat, 18 Sep 2021 22:04:23 -0400	[thread overview]
Message-ID: <a86e6201-7da7-6ec7-f720-49b3883987fb@polymtl.ca> (raw)
In-Reply-To: <BYAPR11MB26632A15985C8FC698BC961697DD9@BYAPR11MB2663.namprd11.prod.outlook.com>

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

  reply	other threads:[~2021-09-19  2:04 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 [this message]
2021-09-20 17:06   ` John Baldwin
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=a86e6201-7da7-6ec7-f720-49b3883987fb@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=Lei.Ge@windriver.com \
    --cc=Wenyan.Xin@windriver.com \
    --cc=gdb@sourceware.org \
    /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).