From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9ma1F5G/SGGyFAAAWB0awg (envelope-from ) for ; Mon, 20 Sep 2021 13:06:25 -0400 Received: by simark.ca (Postfix, from userid 112) id 508BB1EE25; Mon, 20 Sep 2021 13:06:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=MAILING_LIST_MULTI, NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8EE711EE14 for ; Mon, 20 Sep 2021 13:06:24 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BFE63857C59 for ; Mon, 20 Sep 2021 17:06:24 +0000 (GMT) Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id EA7233858D3C for ; Mon, 20 Sep 2021 17:06:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA7233858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id B505395D1D; Mon, 20 Sep 2021 17:06:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCrYV4QPmz4bXL; Mon, 20 Sep 2021 17:06:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0A52520E58; Mon, 20 Sep 2021 17:06:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: GDB will set bp at a function for RISC-V when step over this function call To: Simon Marchi , "Ge, Lei" , "gdb@sourceware.org" References: From: John Baldwin Message-ID: Date: Mon, 20 Sep 2021 10:06:04 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Xin, Wenyan" Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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