Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: ``set mips abi''
Date: Tue, 18 Jun 2002 14:22:00 -0000	[thread overview]
Message-ID: <3D0FA494.3040706@cygnus.com> (raw)
In-Reply-To: <20020613185151.GA352@nevyn.them.org>

> 2002-06-13  Daniel Jacobowitz  <drow@mvista.com>
> 
> 	* 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



  reply	other threads:[~2002-06-18 21:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-13 11:51 Daniel Jacobowitz
2002-06-18 14:22 ` Andrew Cagney [this message]
2002-06-18 14:34   ` Daniel Jacobowitz
2002-06-18 15:26     ` Andrew Cagney
2002-06-18 15:34       ` Daniel Jacobowitz
2002-06-19  2:00         ` Andreas Schwab
2002-06-19  9:45 ` Daniel Jacobowitz
2002-06-19 11:43   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D0FA494.3040706@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox