From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123847 invoked by alias); 21 Oct 2018 03:22:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 123801 invoked by uid 89); 21 Oct 2018 03:22:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 21 Oct 2018 03:22:21 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 289A01E514; Sat, 20 Oct 2018 23:22:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1540092140; bh=brDSqoLCzqPVb80KJnmEOX1wHUdx6m0CZNUwXcyDr4M=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=cDSOf1lDUNM96ymKAVjL8YNpVo2n6kMa2yNQYD3uJPziHVhtmG6s/EyF4DcYGmjhK aVe1SbhCt85S61DwzOBvZiDsLRe5FwCYgSFaf/6DF5/SN0MH8gxMoHEAPtmpJPqDnw cKWomU60R5tH9ciK0ikazxDfkYVLdEG68Di44Khc= Subject: Re: [1/2] C-SKY Port To: Hafiz Abid Qadeer , gdb-patches@sourceware.org Cc: jiangshuai_li@c-sky.com References: <1b689bab-bb28-7ba9-9602-d66f0568ff28@simark.ca> From: Simon Marchi Message-ID: <1799f181-2531-dc53-4934-6f436a2b858c@simark.ca> Date: Sun, 21 Oct 2018 03:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00463.txt.bz2 On 2018-10-20 11:04 p.m., Hafiz Abid Qadeer wrote: > On 20/10/18 19:55, Simon Marchi wrote: >> On 2018-07-25 6:54 a.m., Hafiz Abid Qadeer wrote: > >> Hi Hafiz, >> >> I noticed the "cooked_read" selftest fails with c-sky (ever since the c-sky support was added): >> >> (gdb) maintenance selftest cooked_read >> Running selftest regcache::cooked_read_test. >> ... >> Self test failed: arch csky: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck510: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck610: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck801: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck802: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck803: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck807: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:ck810: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> Self test failed: arch csky:any: self-test failed at /home/simark/src/binutils-gdb/gdb/regcache.c:1697 >> ... >> Self test failed: self-test failed at /home/simark/src/binutils-gdb/gdb/selftest-arch.c:86 >> Ran 1 unit tests, 1 failed >> >> Could you take a look? > Hi Simon, > Thanks for letting me know. I am traveling at the moment. Will take a > look at it when I am back in a few days. Ok, thanks! A quick investigation shows it's because some raw registers are not in the save reggroup. So csky should probably be added to that big if in the test: if (bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_h8300 || bfd_arch == bfd_arch_m32c || bfd_arch == bfd_arch_sh || bfd_arch == bfd_arch_alpha || bfd_arch == bfd_arch_v850 || bfd_arch == bfd_arch_msp430 || bfd_arch == bfd_arch_mep || bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_v850_rh850 || bfd_arch == bfd_arch_tic6x || bfd_arch == bfd_arch_mn10300 || bfd_arch == bfd_arch_rl78 || bfd_arch == bfd_arch_score || bfd_arch == bfd_arch_riscv) { /* Raw registers. If raw registers are not in save_reggroup, their status are unknown. */ if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) SELF_CHECK (status == REG_VALID); else SELF_CHECK (status == REG_UNKNOWN); } else SELF_CHECK (status == REG_VALID); But I'm tempted to replace all of that with simply; /* Raw registers. If raw registers are not in save_reggroup, their status are unknown. */ if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) SELF_CHECK (status == REG_VALID); else SELF_CHECK (status == REG_UNKNOWN); We won't have to maintain this big list, and I don't think we lose any testing coverage/safety. For architectures for which all raw registers are in the save_reggroup (all arches not listed above), we will still always assert that status == REG_VALID. I'll let you take a look when you have time. Simon