From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by sourceware.org (Postfix) with ESMTPS id DEFC83851C38 for ; Mon, 8 Jun 2020 21:39:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DEFC83851C38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x441.google.com with SMTP id t18so19073482wru.6 for ; Mon, 08 Jun 2020 14:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IidmtfekBD0N/wWhAK193Ox7Q9kf/Aq2/XIdnfdGq18=; b=RKS1xVD99QsoihaOrnMYJ0JDYeaKnbKKpts4vXjM3yB7eRWkIK1dGHcF3Iylan4Z6d X67tRIb7mlWOCNKQrzB8I88Yg7yi445LwwEJfqX0ge8uvA4AIXgijGDb9+wO+ud4L+hf /RakRD+VonEkLcGO6dfZ1POT7Bi1O8PWxTzhQYHRep/iaSLs2SVPgVxCb7h2haAT1VBC zYKN9TMousjnlCoZ1ulPUsNw/WnviKkJ819YQ5Naz9sobuxILT88IYH9Bv2V2HFL8Fdx 9cCeR98/INzYx1G7Fmy4zvq5t3BCvbN+wTYMu4M9P3aQoVjkqUw4bQI6NhLu9Fi9MEP5 12mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IidmtfekBD0N/wWhAK193Ox7Q9kf/Aq2/XIdnfdGq18=; b=cSH5XMzjrKHgiZw0ArYoucWNI6j1PXeBQ/4XMsrDlGQXv/Wo+ZerpHgTSySFS6wBtl 8r+VJ+wmL6Rxd8/mXYPJ/zHFxGmTNGKProFVnjXT1IiSbAubCujOkUdnm/We/4n81d71 tI5cdwoeFqHUnqZl4CtEGNfukmCGH6JrHw1mW15KX36QRjEs2f68jHsdIJcJ33jCSo4s 2dVNW1YbCD2nHFUeuwQOgQ4CL5/XegiFcPEJ+hIqBhp+QmYqTa/1xtp2PFDKIaDHkNiD uYRtQjrE6yC2C8MFuHFj8FW20fCLv60sgWPUu7XWkcydeLi7RZ99T9yaY+VFGUFdnZiQ QjWw== X-Gm-Message-State: AOAM533QJF0DoNl4uMICSUScGk2BuXbgQcLBoBCY77ok1XC1UtmIlxlz tuydhRjQfPhR8Fs9t3sXcw1gVg== X-Google-Smtp-Source: ABdhPJx2V6WdiSeVukqMOfPbZxk9E8q+a6Wyt1GIi8APjDA+m52ukDDo11CUlwu7N5vdxTnAjTbbXA== X-Received: by 2002:a5d:6586:: with SMTP id q6mr776272wru.319.1591652369915; Mon, 08 Jun 2020 14:39:29 -0700 (PDT) Received: from localhost (host86-128-12-16.range86-128.btcentralplus.com. [86.128.12.16]) by smtp.gmail.com with ESMTPSA id a16sm1030110wrx.8.2020.06.08.14.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 14:39:28 -0700 (PDT) Date: Mon, 8 Jun 2020 22:39:27 +0100 From: Andrew Burgess To: Tom Tromey Cc: Nelson Chu , gdb-patches@sourceware.org Subject: Re: [0/1] RISC-V: Update CSR to priv 1.11. Message-ID: <20200608213927.GC2737@embecosm.com> References: <1584007257-14466-1-git-send-email-nelson.chu@sifive.com> <87r1upefg8.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r1upefg8.fsf@tromey.com> X-Operating-System: Linux/5.6.15-200.fc31.x86_64 (x86_64) X-Uptime: 22:33:47 up 11:40, 1 user, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2020 21:39:32 -0000 * Tom Tromey [2020-06-08 09:37:43 -0600]: > >>>>> ">" == Nelson Chu writes: > > >> Since RISCV priv spec 1.11 has been officially released, it would be good if > >> binutils, gdb, qemu and OpenOCD can support the new CSR. Therfore, I update > >> the CSR to 1.11 in binutils, and the gdm xml files and gas/testsuite/gas/riscv/csr-dw-regnums > >> also need to be updated. There are two difference between 1.10 and 1.11, > > >> 1. 0x320 is mcountinhibit rather than mucounteren. You can still use the > >> mucounteren, but objdump will show mcountinhibit for it. > > >> 2. 0x7b2 is dscratch0 rather than dscratch, and 0x7b3 is dscratch1. You > >> can still use the old naming, but objdump will show the new one. > > I noticed that this patch broke compatibility between gdb and some > versions of qemu. > > We're using qemu 4.0.0. Our internal test suite has many failures if I > run an unpatched gdb against this version -- locally I've backed out all > RISC-V patches since this one, but that's getting cumbersome, and I > belated realized I should probably just bring this up. > > A typical failure looks like: > > (gdb) info registers dscratch > dscratch Could not fetch register "dscratch"; remote failure reply 'E14' > > It seems to me that the best thing to do would be to have gdb adapt to > the registers that are reported by the remote. Is there a reason this > was not done? Unless I misunderstand here, you asking why we don't use the xml target descriptions? We do. Or we _should_ do. Maybe it's not working? Is your target definitely sending back a description? And it definitely includes register "dscratch" ? This patch (the only you replied too) is only changing the default xml description, the one that gets picked up if the target doesn't supply a description. I'll try to get QEMU built and running tomorrow and see if I can give you a better answer, however, the patch below might help. It adds an alias from 'dscratch' to 'dscratch0', so your 'info registers dscratch' should start working again. Let me know if this helps at all. Thanks, Andrew --- diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 6edf77a0ce0..42ca6440756 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -3380,6 +3380,10 @@ riscv_gdbarch_init (struct gdbarch_info info, riscv_setup_register_aliases (gdbarch, &riscv_freg_feature); riscv_setup_register_aliases (gdbarch, &riscv_csr_feature); + static int dscratch_regnum = RISCV_CSR_DSCRATCH0_REGNUM; + user_reg_add (gdbarch, "dscratch", value_of_riscv_user_reg, + &dscratch_regnum); + /* Compile command hooks. */ set_gdbarch_gcc_target_options (gdbarch, riscv_gcc_target_options); set_gdbarch_gnu_triplet_regexp (gdbarch, riscv_gnu_triplet_regexp);