From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23271 invoked by alias); 13 Jan 2017 01:54: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 23190 invoked by uid 89); 13 Jan 2017 01:54:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=30pm, 170113, 17-01-13, Hx-languages-length:1511 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f194.google.com Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jan 2017 01:54:18 +0000 Received: by mail-pf0-f194.google.com with SMTP id b22so5818050pfd.3; Thu, 12 Jan 2017 17:54:18 -0800 (PST) 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:user-agent; bh=maO0lmq5OrHSAE5C1U3DzeQNHN9Ytd1S9iWVLePkYtA=; b=pTfFqebgc2Df8SEsVyXzkojIMCx0YQVUwFpmEcYy842crRRH5TIpQxlgjX/9XIFfq5 x7SZv6fpZ2kDCe+ce4by1cNIT1KYNksuWGjuH2owFuKGUZyuFElxcH7X1MS3zAhk5+1h usGyGhMmJXaU2SP/i+rfQXRDETxsEQGxh03sa5r/gxL/rrDRI3h+vzEhNm49ai/p0L4k UtV7lCQABNTRyKHY/yUEl1hSIuaCGEAoKp0uB3yrGnPjwXXyRmFYQKlGE6z1IXICVo5v rc88RJwB1Lp2wgS4E4R8NANxf0I7OJon/b5/bzVr60Ffy/4sDLbfFMlxxj5vYpaSAJvl xqcg== X-Gm-Message-State: AIkVDXIwIzrXvHqMsUUczTzkMyDd5fG1aOgP9yBt5Ua550ze7TqOLhOqtNohuPq4Er+fMg== X-Received: by 10.98.38.134 with SMTP id m128mr20081023pfm.27.1484272456811; Thu, 12 Jan 2017 17:54:16 -0800 (PST) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id 21sm24465760pfy.4.2017.01.12.17.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jan 2017 17:54:16 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 36D47C1667; Fri, 13 Jan 2017 12:24:12 +1030 (ACDT) Date: Fri, 13 Jan 2017 01:54:00 -0000 From: Alan Modra To: Yao Qi Cc: binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH 6/8] Return -1 on memory error in print_insn_m68k Message-ID: <20170113015412.GQ32333@bubble.grove.modra.org> References: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> <1484051178-16013-7-git-send-email-yao.qi@linaro.org> <20170111221514.GI32333@bubble.grove.modra.org> <20170112115021.GB31406@E107787-LIN> <20170112143813.GK32333@bubble.grove.modra.org> <20170112145230.GE31406@E107787-LIN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170112145230.GE31406@E107787-LIN> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2017-01/txt/msg00260.txt.bz2 On Thu, Jan 12, 2017 at 02:52:30PM +0000, Yao Qi wrote: > On 17-01-13 01:08:14, Alan Modra wrote: > > On Thu, Jan 12, 2017 at 11:50:21AM +0000, Yao Qi wrote: > > > On 17-01-12 08:45:14, Alan Modra wrote: > > > > On Tue, Jan 10, 2017 at 12:26:16PM +0000, Yao Qi wrote: > > > > > * m68k-dis.c (match_insn_m68k): Extend comments. Return -1 > > > > > if FETCH_DATA returns 0. > > > > > (m68k_scan_mask): Likewise. > > > > > (print_insn_m68k): Update code to handle -1 return value. > > > > > > > > This misses one FETCH_DATA call, in m68k_scan_mask. > > > > > > > > > > I can't remember the reason I didn't change it. Sorry. > > > > Actually there is a good reason not to change that call, I just didn't > > look at the code well enough and thought you'd accidentally missed > > it. The previous patch is OK. The newest one would fail if you had > > a 2-byte insn at the end of a segment and happened to try a 4-byte > > insn match first. > > > > Hi Alan, > This won't happen in the 2nd patch, because if the instruction is 2-byte, > it won't read and match the next 2 bytes. There is a guard > ((0xffff & match) != 0) for read. Am I missing something? The code is looping over an opcode table. You might try to match a 4-byte instruction from the opcode table before matching the 2-byte instruction you have. If you exit the loop due to failing to read 4 bytes then you won't disassemble the instruction. -- Alan Modra Australia Development Lab, IBM