From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22463 invoked by alias); 18 Jun 2002 21:22:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22445 invoked from network); 18 Jun 2002 21:22:28 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 18 Jun 2002 21:22:28 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id A8ED63D78; Tue, 18 Jun 2002 17:22:28 -0400 (EDT) Message-ID: <3D0FA494.3040706@cygnus.com> Date: Tue, 18 Jun 2002 14:22:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020613 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: ``set mips abi'' References: <20020613185151.GA352@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-06/txt/msg00333.txt.bz2 > 2002-06-13 Daniel Jacobowitz > > * mips-tdep.c (enum mips_abi): Explicitly start at 0. > (mips_abi_string, mips_abi_strings): New. > (struct gdbarch_tdep): Remove mips_abi_string, add found_abi. > (mips_gdbarch_init): Set tdep->found_abi. Don't set > tdep->mips_abi_string. Honor mips_abi_string. Default to > O32 if no ABI is found. > (mips_dump_tdep): Use mips_abi_strings. > (mips_abi_update): New function. > (_initialize_mips_tdep): Initialize mips_abi_string. Add > ``set mips abi'' and ``show mips abi''. > I think the way to construct this table: > +static const char *mips_abi_string; > +static const char *mips_abi_strings[] = { > + "auto", > + "n32", > + "o32", > + "o64", > + "eabi32", > + "eabi64", > + NULL > +}; is like: > /* Various MIPS ISA options (related to stack analysis) can be > overridden dynamically. Establish an enum/array for managing > them. */ > > static const char size_auto[] = "auto"; > static const char size_32[] = "32"; > static const char size_64[] = "64"; > > static const char *size_enums[] = { > size_auto, > size_32, > size_64, > 0 > }; and then: > static unsigned int > mips_saved_regsize (void) > { > if (mips_saved_regsize_string == size_auto) > return MIPS_DEFAULT_SAVED_REGSIZE; > else if (mips_saved_regsize_string == size_64) > return 8; > else /* if (mips_saved_regsize_string == size_32) */ > return 4; > } > That avoids needing to keep the enum and string in sync. (Having an enum mechanism that bound a number to a name would be nice). Otherwize yes, ok. enjoy, Andrew