From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111290 invoked by alias); 12 Mar 2018 18:54:05 -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 110007 invoked by uid 89); 12 Mar 2018 18:54:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1032 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Mar 2018 18:54:03 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w2CIrvac025170 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 12 Mar 2018 14:54:01 -0400 Received: by simark.ca (Postfix, from userid 112) id D09F11E7A4; Mon, 12 Mar 2018 14:53:56 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 553F01E481; Mon, 12 Mar 2018 14:53:55 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 12 Mar 2018 18:54:00 -0000 From: Simon Marchi To: Yao Qi Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Make arm_record_test work on big-endian machines In-Reply-To: <86po49dxw3.fsf@gmail.com> References: <20180312030943.32669-1-simon.marchi@polymtl.ca> <86tvtle5wo.fsf@gmail.com> <86po49dxw3.fsf@gmail.com> Message-ID: <907342c39bf37dae5f6498abc5887dd4@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.4 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 12 Mar 2018 18:53:57 +0000 X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00260.txt.bz2 On 2018-03-12 13:09, Yao Qi wrote: > Simon Marchi writes: > >> What do you think about the patch below? Functionally, it should be >> identical >> to what you suggested, but I think it's clear to fix extract_arm_insn >> instead. >> > > Patch looks good to me. Thanks. > >> + >> + insn_record->arm_insn >> + = (uint32_t) extract_unsigned_integer (&buf[0], 2, endian); >> + >> + if (insn_size == 4) >> + { >> + insn_record->arm_insn <<= 16; >> + insn_record->arm_insn >> + |= (uint32_t) extract_unsigned_integer (&buf[2], 2, endian); > > Better to add some comments here. Oh, actually, does my patch get it wrong for ARM instructions? For them, it seems like in little endian, the four bytes of an instruction are reversed (as if it was a 4-byte value). So that would explain why the word swap would only occur under a if (THUMB2_RECORD == record_type). There is no test with ARM instructions in arm_record_test... should there be one? Simon