From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116891 invoked by alias); 27 Oct 2016 14:54:56 -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 116852 invoked by uid 89); 27 Oct 2016 14:54:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=20160831, *const, Hx-languages-length:2220 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; Thu, 27 Oct 2016 14:54:45 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C2684E4EE; Thu, 27 Oct 2016 14:54:44 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9REsgHe026987; Thu, 27 Oct 2016 10:54:43 -0400 Subject: Re: [PATCH 06/13] Add enum for mips breakpoint kinds To: Yao Qi , gdb-patches@sourceware.org References: <1472655965-12212-1-git-send-email-yao.qi@linaro.org> <1472655965-12212-7-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: <781ba8eb-ba42-58e0-1ead-ae44d8a39409@redhat.com> Date: Thu, 27 Oct 2016 14:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1472655965-12212-7-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00757.txt.bz2 On 08/31/2016 04:05 PM, Yao Qi wrote: > This patch adds an enum mips_breakpoint_kinds to avoid using magic > numbers as much as possible. > > gdb: > > 2016-08-31 Yao Qi > > * mips-tdep.c (mips_breakpoint_kinds): New enum. > (mips_breakpoint_from_pc): Use it. > (mips_remote_breakpoint_from_pc): Likewise. > --- > gdb/mips-tdep.c | 37 ++++++++++++++++++++++--------------- > 1 file changed, 22 insertions(+), 15 deletions(-) > > diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c > index 4e4d79e..34df8d0 100644 > --- a/gdb/mips-tdep.c > +++ b/gdb/mips-tdep.c > @@ -107,6 +107,20 @@ static const char *const mips_abi_strings[] = { > NULL > }; > > +/* Enum describing the different kinds of breakpoints. */ > + > +enum mips_breakpoint_kinds IMO that should be singular. Imagine you put one of these in a variable. Like: enum mips_breakpoint_kinds kind; This would be more natural, IMO: enum mips_breakpoint_kind kind; > +{ > + /* 16-bit MIPS16 mode breakpoint */ > + MIPS_BP_KIND_16BIT_MIPS16 = 2, > + /* 16-bit microMIPS mode breakpoint */ > + MIPS_BP_KIND_16BIT_MICROMIPS = 3, > + /* 32-bit standard MIPS mode breakpoint */ > + MIPS_BP_KIND_32BIT = 4, > + /* 32-bit microMIPS mode breakpoint */ > + MIPS_BP_KIND_32BIT_MICROMIPS = 5, IMO a line break between these makes it much more readable. /* 16-bit MIPS16 mode breakpoint */ MIPS_BP_KIND_16BIT_MIPS16 = 2, /* 16-bit microMIPS mode breakpoint */ MIPS_BP_KIND_16BIT_MICROMIPS = 3, etc. > +}; > + > /* For backwards compatibility we default to MIPS16. This flag is > overridden as soon as unambiguous ELF file flags tell us the > compressed ISA encoding used. */ > @@ -7143,16 +7157,7 @@ mips_breakpoint_from_pc (struct gdbarch *gdbarch, > } > } > > -/* Determine the remote breakpoint kind suitable for the PC. The following > - kinds are used: > - > - * 2 -- 16-bit MIPS16 mode breakpoint, > - > - * 3 -- 16-bit microMIPS mode breakpoint, > - > - * 4 -- 32-bit standard MIPS mode breakpoint, > - > - * 5 -- 32-bit microMIPS mode breakpoint. */ In a latter patch you seem to read this comment. > +/* Determine the remote breakpoint kind suitable for the PC. */ Thanks, Pedro Alves