From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18165 invoked by alias); 11 Oct 2017 10:36:35 -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 18125 invoked by uid 89); 11 Oct 2017 10:36:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2184 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Oct 2017 10:36:34 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A480281E1E; Wed, 11 Oct 2017 10:36:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A480281E1E Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id B41D1600C8; Wed, 11 Oct 2017 10:36:31 +0000 (UTC) Subject: Re: [PATCH] arc: Pass proper CPU value to disassembler To: Anton Kolesov , gdb-patches@sourceware.org References: <20171010192211.28047-1-Anton.Kolesov@synopsys.com> Cc: Francois Bedard From: Pedro Alves Message-ID: <679b988a-e853-82eb-b777-5cbcd6890176@redhat.com> Date: Wed, 11 Oct 2017 10:36:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171010192211.28047-1-Anton.Kolesov@synopsys.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-10/txt/msg00276.txt.bz2 On 10/10/2017 08:22 PM, Anton Kolesov wrote: > +/* ARC EM and ARC HS are unique BFD arches, however they share the same machine > + number as "ARCv2". */ > + > +static inline bool > +arc_arch_is_hs (const struct bfd_arch_info* arch) > +{ > + return CONST_STRNEQ (arch->printable_name, "HS"); > +} > + > +static inline bool > +arc_arch_is_em (const struct bfd_arch_info* arch) > +{ > + return CONST_STRNEQ (arch->printable_name, "EM"); > +} I'd prefer if you used startswith instead. There's not much point in using CONST_STRNEQ nowadays, and we don't tend to use it in GDB -- compilers have no trouble constant folding the length of string literals. > +gdb_start > + > +# Test whether it ok to have `arc:HS` in target description architecture. "it's OK" ... "in the target" > +# `HS` is a valid BFD architecture name, however disassembler doesn't accept "the disassembler" > +# it as a CPU name. This test checks that GDB doesn't pass architecture from > +# target description directly to disassembler and instead uses one of the "the target description" ... "the disassembler" > +# valid CPU names. > + > +set filename $srcdir/$subdir/arc-tdesc-cpu.xml > + > +set cmd "set tdesc filename $filename" > +gdb_test $cmd > + > +# Error message is emitted by disassembler, therefore it is not shown unless "An error" ... "the disassembler" (x2). > +# disassembler is actually invoked. Address "0" is not invalid, but that > +# doesn't matter for this test case, because it is only disassembler error > +# message that is interesting. "the disassembler" > +set cmd "x /i 0" > +set msg "setting HS architecture" > +gdb_test_multiple $cmd $msg { > + -re "Unrecognised disassembler CPU option: HS" { Must match $gdb_prompt too, otherwise the prompt is left in the expect buffer and confuses following gdb_test/gdb_test_multiple calls. > + fail $msg > + } > + -re "\r\n$gdb_prompt" { This seems a bit fragile. If the error output ever changes, then this will match, and thus will always pass. Can this regex be tightened a bit to include something more than just the prompt? > + pass $msg > + } > +} Thanks, Pedro Alves