From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mm5mBGfObWEaVwAAWB0awg (envelope-from ) for ; Mon, 18 Oct 2021 15:43:35 -0400 Received: by simark.ca (Postfix, from userid 112) id F30BA1F0BD; Mon, 18 Oct 2021 15:43:34 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 D9B3E1EDDB for ; Mon, 18 Oct 2021 15:43:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F9333858437 for ; Mon, 18 Oct 2021 19:43:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F9333858437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634586212; bh=57yinAjuWkgQXZZbWxkpUQ/VFizdQhiDFLMAQ7PjP1o=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=VXjnDzIiF23rL2fE0EDM3CXbs5TBDSV53hj1He2x8HpPZRjo5Yy1g8hWlh47poaHL XY8wvaj9Xe5YRpSp0N/6lhCL/Lf8j9ysscyAb3Uo+ImEqMrhI8Y3V7h+r4wW0r7tJM wu3nCS+2UHcte0Cl/QwvX3i+n1KB44buF1l+emgA= Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id 478343858404 for ; Mon, 18 Oct 2021 19:43:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 478343858404 Received: by mail-io1-xd2e.google.com with SMTP id x1so17629223iof.7 for ; Mon, 18 Oct 2021 12:43:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=57yinAjuWkgQXZZbWxkpUQ/VFizdQhiDFLMAQ7PjP1o=; b=DKmGVSWB9yqnzZKhu/pG6lFgVNdC64DNDUkS2Yu8GrCfxBbxG+XiZ/pHL3Smd/Tx6R deqiz940xgeqtt7vTb/Jv5+67KmBTAYAvNGxBO0xWRAdXpmFDR0raolefQUiBKMALLc+ RJNLYoh95ONFcZyzQxuwFUgYOQtNx6e3qRZZcvmSvRdSVAQvVDtoqaG7nnTGyduMfI/X sER6nnNVTLazoI4PE6Cghxn5gJlZg39s9wilgdVaOUSuwTxUiBqOqTxEldiel5g0ZI79 cGuhvBt6M+twfGiKS2Jkdoov6KW5wjObRsUbkw6nWOVD6hhA1ysUmQl1egEU/yU8nno+ ROIA== X-Gm-Message-State: AOAM5310ADwyg0W/RPvOD/4yBB1pv7rDfwUzmVmGqxVg1peloUFnrL8I 1dJcqMqO22KHlFQlMwyNbt5zv/VZd7jCjw== X-Google-Smtp-Source: ABdhPJw9+1Eigl0kp/DTtn/Y8woPH14+e5dSeXtCMCusQfkIJ5EsYqiMwVlQMM9SIEiCImRdS3gVoQ== X-Received: by 2002:a5d:9492:: with SMTP id v18mr15813313ioj.158.1634586192720; Mon, 18 Oct 2021 12:43:12 -0700 (PDT) Received: from murgatroyd.Home (174-16-0-219.hlrn.qwest.net. [174.16.0.219]) by smtp.gmail.com with ESMTPSA id h2sm6903702ioh.14.2021.10.18.12.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:43:12 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH v2] Avoid self-test failures on x86-linux Date: Mon, 18 Oct 2021 13:43:08 -0600 Message-Id: <20211018194308.177367-1-tromey@adacore.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , From: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The disassembly tests in "maint selftest" will fail on x86-linux. This happens because opcodes rejects an attempt to disassemble for an arch with a 64-bit address size when bfd_vma is 32-bit. This patch avoids this problem by avoiding the test in this case. I chose to do it this way because this seems to be the only situation where opcodes checks the size of bfd_vma. For v2 of this patch, I've also updated memory_error_test to do the same thing. This is needed due to the "improve error reporting from the disassembler" patch. --- gdb/disasm-selftests.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c index 0a383d6b795..59c09c98381 100644 --- a/gdb/disasm-selftests.c +++ b/gdb/disasm-selftests.c @@ -85,8 +85,19 @@ print_one_insn_test (struct gdbarch *gdbarch) /* PR 21003 */ if (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arc601) return; + goto generic_case; + case bfd_arch_i386: + { + const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch); + /* The disassembly tests will fail on x86-linux because + opcodes rejects an attempt to disassemble for an arch with + a 64-bit address size when bfd_vma is 32-bit. */ + if (info->bits_per_address > sizeof (bfd_vma) * CHAR_BIT) + return; + } /* fall through */ default: + generic_case: { /* Test disassemble breakpoint instruction. */ CORE_ADDR pc = 0; @@ -187,6 +198,16 @@ memory_error_test (struct gdbarch *gdbarch) } }; + if (gdbarch_bfd_arch_info (gdbarch)->arch == bfd_arch_i386) + { + const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch); + /* This test will fail on x86-linux because opcodes rejects an + attempt to disassemble for an arch with a 64-bit address size + when bfd_vma is 32-bit. */ + if (info->bits_per_address > sizeof (bfd_vma) * CHAR_BIT) + return; + } + gdb_disassembler_test di (gdbarch); bool saw_memory_error = false; -- 2.31.1