From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 29D96386F0DF for ; Tue, 28 Jun 2022 15:52:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29D96386F0DF 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 [96.47.72.80]) (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 A3C7F8780D; Tue, 28 Jun 2022 15:52:22 +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 4LXTck41xBz4hjr; Tue, 28 Jun 2022 15:52:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656431542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HoEpv2e4n2DkrtMHqXK4qpiAHxuFYgtrR1cpGfj1TJU=; b=tKyAJJN46HiYmJz/xGvdWD8vJF6cL9mEeCyEtFmDD0KDBWpKZ+A69c/zPaSSBNt5o1fnt2 Jm9I7DHqJvQr46BbzuCEy76px1b3C43A06R7zWvDymjogXVp0TqGQtLeRzrQkXMhvLyp+G RFvk6FqyTobBPlHXoGydhqzRRhBrL75ed614mpATrqd6wSoBO88+YNSypCTTnkfjw9S2su 9yDwlLM4IOvawXTyXh1rhOkYDeHwHAs0VUyEnGx2dZmGUhDuq4Gocuvr5bB87ZykUpOagv Cjfh3lgjhStB5p2zze4RWZ46zzKm8uRpmwMOJ314suRIepWBpdfnMi3I018JLA== Received: from [IPV6:2601:648:8680:ed60:4ae:47ca:8c0b:140e] (unknown [IPv6:2601:648:8680:ed60:4ae:47ca:8c0b:140e]) (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 1EE4A864; Tue, 28 Jun 2022 15:52:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <069ae440-5fc5-b853-e415-e9643e6d8144@FreeBSD.org> Date: Tue, 28 Jun 2022 08:52:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: James Becker , gdb@sourceware.org References: From: John Baldwin Subject: Re: gdb for Riscv, single stepping issue In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656431542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HoEpv2e4n2DkrtMHqXK4qpiAHxuFYgtrR1cpGfj1TJU=; b=I/qtDB7lHO11eNbT4fcCKjPke90YtXMxeHiKmB8cFNZKMS/j2gipGu+S7ORFRtmi3BObi4 K0QxDHjM0EkPY4TjDJ4++Sinvi2h6RVXS1OlhKlCc6DaP9V6PnJIJzfWGjllpqo8lOpNF7 vX08lrztfGnccGm16+kjkBxrR0gt3BKUbFg9Cm/U1o1JhmQv6N+xOKr6vcJ/2DzMF7kRnD P7fi179XfkJMfLftWPtN65YjOmDszHrTEEVrdL6YGlBT9UViOuOORUf0f1KPwX+cdw/otN HYSVsGg23ERWdH8XW181AosHxGdwtTyRkY3X4QgpbbgEgWTccbmSqdKO7IWRvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656431542; a=rsa-sha256; cv=none; b=dNqUhfBTXOKHDA8hhds3Yl5oH8mYjNOooBqtBlN015bZSZBnr6KiF8H79QajOeVwfK552Y sihTSRUg0HjNw8Z5M9+AofxbKY8xJfEaUXVB/TBa1ttkbjLNKueZefrkiedUShFeXFhq9p sXJukuigHFa+5c5f81qxvjj3d4pzlrwLEDG0hUOQOa+33I6w3JXqNzcH071ZOZb60UUoRu nseRh6nOjL6PjNqCKsM/NZdD8WbkMJw1GEXq/VVu64AjNFquqZIYwxfQgWoTRIiOEYB5DL C90rDy141z6BWLNryCeRaXDa5sdfl7yHLcT5Dqq0gZ+78AFTzOLsuyza64OOgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 28 Jun 2022 15:52:25 -0000 On 6/27/22 1:40 PM, James Becker wrote: > Hello, > > I have a RISCV-EL2 core running in a Nexys A7 FPGA board. > > I have openocd for riscv running over jtag with a connection by > riscv-gdb to the openocd instance at port 3333. > > Everything works fine, stepping, break points, load, view memory. > > But I have one issue: Some of the memory in my design is 4 byte > aligned.  Its designed for fast instruction fetch, its known as ICCM. > > When I have code running in that memory, gdb still works fine for > breakpoints, but it will not single step. > > Looking at the openocd debug files, it appears that gdb is attempting to > do a 2 byte read as a part of the single stepping procedure. > > Since my memory does not support 2 byte reads or writes, this fails. > > Is there some way that gdb can be configured to not do any 2-byte word > reads or writes during single stepping?  I can't seem to find any. Hmm, setting breakpoints tries to read 1 byte at a time unless you have disabled compressed breakpoints. It looks like as a local hack you could change use-compressed-breakpoints to just read 4 bytes rather than 2 initially? Perhaps this is upstreamable if you make it read 4 bytes if the target address is 4 byte aligned and only fall back to reading 2 bytes if it isn't? -- John Baldwin