From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16445 invoked by alias); 22 Oct 2014 15:41:47 -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 16436 invoked by uid 89); 22 Oct 2014 15:41:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 22 Oct 2014 15:41:46 +0000 Received: by mail-pa0-f54.google.com with SMTP id rd3so3247986pab.27 for ; Wed, 22 Oct 2014 08:41:44 -0700 (PDT) X-Received: by 10.70.131.199 with SMTP id oo7mr2404032pdb.163.1413992504585; Wed, 22 Oct 2014 08:41:44 -0700 (PDT) Received: from [192.168.1.100] ([223.72.65.79]) by mx.google.com with ESMTPSA id i2sm2336384pat.3.2014.10.22.08.41.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 08:41:43 -0700 (PDT) Message-ID: <5447D02A.60109@gmail.com> Date: Wed, 22 Oct 2014 15:41:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Andreas Schwab , Joel Brobecker Subject: Re: [PATCH v2] gdb/hppa-tdep.c: Fix logical working flow typo issue References: <5447CF8A.6020603@gmail.com> In-Reply-To: <5447CF8A.6020603@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-10/txt/msg00581.txt.bz2 On 10/22/2014 11:38 PM, Chen Gang wrote: > inst_saves_gr() wants to recognize 'st??' instruction, according to the > code we know it include 'stb' (for store byte), 'stw(m)' (for store > word), and 'std' (for store double word). > > They should be in the same format, and have neighbour numbers: > especially, 'stw(m)' need be in the middle of 'stb' and 'std'. > > - for ((inst >> 26) != 0x3): > > stb: 0x18, or 0x19, > stw: 0x1a, stwm: 0x1b, > std: 0x1c. > > - else ((inst >> 26) == 0x3), need check: > > stb: 0x08, or 0x09, > stw: 0x0a, > std: 0x0b. > > For clearer reason, not combine the logical comparation code together. > > 2014-10-22 Chen Gang > > * hppa-tdep.c (inst_saves_gr): Fix logical working flow typo > issue. > > Signed-off-by: Chen Gang > --- > gdb/hppa-tdep.c | 33 ++++++++++++++++++++++++--------- > 1 file changed, 24 insertions(+), 9 deletions(-) > > diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c > index 627f31a..4363ab4 100644 > --- a/gdb/hppa-tdep.c > +++ b/gdb/hppa-tdep.c > @@ -1376,16 +1376,35 @@ is_branch (unsigned long inst) > } > > /* Return the register number for a GR which is saved by INST or > - zero it INST does not save a GR. */ > + zero it INST does not save a GR. > + > + inst_saves_gr() wants to recognize 'st??' instruction, it include 'stb' (for > + store byte), 'stw(m)' (for store word), and 'std' (for store double word). > + > + They should be in the same format, and have neighbour numbers: especially, > + 'stw(m)' need be in the middle of 'stb' and 'std'. > + > + - for ((inst >> 26) != 0x3): > + > + stb: 0x18, or 0x19, > + stw: 0x1a, stwm: 0x1b, > + std: 0x1c. > + > + - else ((inst >> 26) == 0x3), need check : Oh sorry, need remove the whithe space: use "need check:" instead of "need check :". > + > + stb: 0x08, or 0x09, > + stw: 0x0a, > + std: 0x0b. > +*/ > > static int > inst_saves_gr (unsigned long inst) > { > - /* Does it look like a stw? */ > + /* Does it look like a stw(m)? */ > if ((inst >> 26) == 0x1a || (inst >> 26) == 0x1b > || (inst >> 26) == 0x1f > - || ((inst >> 26) == 0x1f > - && ((inst >> 6) == 0xa))) > + || ((inst >> 26) == 0x3 > + && ((inst >> 6) & 0xf) == 0xa)) > return hppa_extract_5R_store (inst); > > /* Does it look like a std? */ > @@ -1394,16 +1413,12 @@ inst_saves_gr (unsigned long inst) > && ((inst >> 6) & 0xf) == 0xb)) > return hppa_extract_5R_store (inst); > > - /* Does it look like a stwm? GCC & HPC may use this in prologues. */ > - if ((inst >> 26) == 0x1b) > - return hppa_extract_5R_store (inst); > - > /* Does it look like sth or stb? HPC versions 9.0 and later use these > too. */ > if ((inst >> 26) == 0x19 || (inst >> 26) == 0x18 > || ((inst >> 26) == 0x3 > && (((inst >> 6) & 0xf) == 0x8 > - || (inst >> 6) & 0xf) == 0x9)) > + || ((inst >> 6) & 0xf) == 0x9))) > return hppa_extract_5R_store (inst); > > return 0; > -- Chen Gang Open share and attitude like air water and life which God blessed