From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105611 invoked by alias); 6 Dec 2016 03:04:40 -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 105050 invoked by uid 89); 6 Dec 2016 03:03:43 -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,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:d7ad7ae, H*MI:sk:d7ad7ae, H*f:sk:d7ad7ae X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Dec 2016 03:03:32 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1cE62U-0003Nh-Ky from Luis_Gustavo@mentor.com ; Mon, 05 Dec 2016 19:03:30 -0800 Received: from [172.30.7.171] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 5 Dec 2016 19:03:27 -0800 Subject: Re: [PATCH] Bug 20928 - Decode %ccr into individual flags in sparcv9 register output References: To: Ivo Raisr , From: Luis Machado Reply-To: Luis Machado Message-ID: <27bde9c3-4f6c-e3fa-93a2-3531ea489e1d@codesourcery.com> Date: Tue, 06 Dec 2016 03:04:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00147.txt.bz2 On 12/05/2016 05:45 PM, Ivo Raisr wrote: > Please find attached a patch which fixes PR tdep/20928. > > Register %ccr on sparcv9 (called sparc64 in gdb's speak) contains > several flags > {icc,xcc}.{cnvz}. They should be properly decoded such as %fprs, %pstate > and %fsr is done currently. > > While at it, decode also properly one-bit flags of %fsr - accrued and > current > exception flags were mixed up. > > Regression test suite was run successfully with gdb 7.11 on > Solaris/sparcv9. > gdb's commands 'info registers' and 'info all-registers' show %ccr with > correctly decoded flags. > > > ChangeLog entry: > 2016-12-05 Ivo Raisr > > PR tdep/20928 > Decode %ccr into individual flags in sparcv9 register output. > * sparc-tdep.h: Declare %ccr type. > * sparc64-tdep.c: Decode %ccr. Fix %fsr decoding. You need to mention the new sparc64_ccr_type field and the new function in the ChangeLog. Also, you need to add the function where you fixed the fsr decoding. > > > > ccr_decoding.patch > > > diff -upr a/ChangeLog b/ChangeLog > --- a/ChangeLog 2016-02-24 01:55:15.000000000 +0000 > +++ b/ChangeLog 2016-12-05 15:38:46.962931312 +0000 > @@ -1,3 +1,10 @@ > +2016-12-05 Ivo Raisr > + > + PR tdep/20928 > + Decode %ccr into individual flags in sparcv9 register output. > + * sparc-tdep.h: Declare %ccr type. > + * sparc64-tdep.c: Decode %ccr. Fix %fsr decoding. > + > 2016-01-12 H.J. Lu > > Sync with GCC > diff -upr a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h > --- a/gdb/sparc-tdep.h 2016-02-09 19:19:39.000000000 +0000 > +++ b/gdb/sparc-tdep.h 2016-12-05 15:25:55.187764842 +0000 > @@ -76,6 +76,7 @@ struct gdbarch_tdep > /* ISA-specific data types. */ > struct type *sparc_psr_type; > struct type *sparc_fsr_type; > + struct type *sparc64_ccr_type; > struct type *sparc64_pstate_type; > struct type *sparc64_fsr_type; > struct type *sparc64_fprs_type; > diff -upr a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c > --- a/gdb/sparc64-tdep.c 2016-02-09 19:19:39.000000000 +0000 > +++ b/gdb/sparc64-tdep.c 2016-12-05 15:26:04.242830444 +0000 > @@ -172,6 +172,31 @@ sparc64_pstate_type (struct gdbarch *gdb > } > > static struct type * > +sparc64_ccr_type (struct gdbarch *gdbarch) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (tdep->sparc64_ccr_type == NULL) > + { > + struct type *type; > + > + type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 8); > + append_flags_type_flag (type, 0, "icc.c"); > + append_flags_type_flag (type, 1, "icc.v"); > + append_flags_type_flag (type, 2, "icc.z"); > + append_flags_type_flag (type, 3, "icc.n"); > + append_flags_type_flag (type, 4, "xcc.c"); > + append_flags_type_flag (type, 5, "xcc.v"); > + append_flags_type_flag (type, 6, "xcc.z"); > + append_flags_type_flag (type, 7, "xcc.n"); > + > + tdep->sparc64_ccr_type = type; > + } > + > + return tdep->sparc64_ccr_type; > +} > + > +static struct type * > sparc64_fsr_type (struct gdbarch *gdbarch) > { > struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > @@ -181,16 +206,16 @@ sparc64_fsr_type (struct gdbarch *gdbarc > struct type *type; > > type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8); > - append_flags_type_flag (type, 0, "NXA"); > - append_flags_type_flag (type, 1, "DZA"); > - append_flags_type_flag (type, 2, "UFA"); > - append_flags_type_flag (type, 3, "OFA"); > - append_flags_type_flag (type, 4, "NVA"); > - append_flags_type_flag (type, 5, "NXC"); > - append_flags_type_flag (type, 6, "DZC"); > - append_flags_type_flag (type, 7, "UFC"); > - append_flags_type_flag (type, 8, "OFC"); > - append_flags_type_flag (type, 9, "NVC"); > + append_flags_type_flag (type, 0, "NXC"); > + append_flags_type_flag (type, 1, "DZC"); > + append_flags_type_flag (type, 2, "UFC"); > + append_flags_type_flag (type, 3, "OFC"); > + append_flags_type_flag (type, 4, "NVC"); > + append_flags_type_flag (type, 5, "NXA"); > + append_flags_type_flag (type, 6, "DZA"); > + append_flags_type_flag (type, 7, "UFA"); > + append_flags_type_flag (type, 8, "OFA"); > + append_flags_type_flag (type, 9, "NVA"); > append_flags_type_flag (type, 22, "NS"); > append_flags_type_flag (type, 23, "NXM"); > append_flags_type_flag (type, 24, "DZM"); > @@ -327,7 +352,7 @@ sparc64_register_type (struct gdbarch *g > if (regnum == SPARC64_ASI_REGNUM) > return builtin_type (gdbarch)->builtin_int64; > if (regnum == SPARC64_CCR_REGNUM) > - return builtin_type (gdbarch)->builtin_int64; > + return sparc64_ccr_type (gdbarch); > if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM) > return builtin_type (gdbarch)->builtin_double; > if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM) > Otherwise looks good to me.