Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: cgd@broadcom.com, gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
Date: Thu, 27 Feb 2003 01:33:00 -0000	[thread overview]
Message-ID: <1030227013326.ZM24848@localhost.localdomain> (raw)
In-Reply-To: Andrew Cagney <ac131313@redhat.com> "Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful" (Feb 26,  4:31pm)

On Feb 26,  4:31pm, Andrew Cagney wrote:

> [...] Can you just change the messages to 
> something more like that before committing?

Sure.  I've just committed the patch below.

Here's an example of it in use:

    (gdb) show mips abi
    The MIPS ABI is set automatically (currently "o32").
    (gdb) file hello-n64-shared 
    Reading symbols from hello-n64-shared...done.
    (gdb) show mips abi
    The MIPS ABI is set automatically (currently "n64").
    (gdb) set mips abi n32
    (gdb) show mips abi
    The MIPS ABI is assumed to be "n32" (due to user setting).
    (gdb) set mips abi auto
    (gdb) show mips abi
    The MIPS ABI is set automatically (currently "n64").
    (gdb) file hello-n32-shared  
    Load new symbol table from "hello-n32-shared"? (y or n) y

    Reading symbols from hello-n32-shared...done.
    (gdb) show mips abi
    The MIPS ABI is set automatically (currently "n32").

Note that this example only shows 2 of the 4 possible messages.  I
think it's unlikely that we'll see the other 2 messages displayed,
but they're there just in case...

Kevin

	* mips-tdep.c (show_mips_abi): New function.
	(_initialize_mips_tdep): Use show_mips_abi() to implement the
	command ``show mips abi''.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.163
diff -u -p -r1.163 mips-tdep.c
--- mips-tdep.c	20 Feb 2003 16:35:51 -0000	1.163
+++ mips-tdep.c	27 Feb 2003 01:10:07 -0000
@@ -6066,6 +6066,38 @@ mips_abi_update (char *ignore_args, int 
   gdbarch_update_p (info);
 }
 
+/* Print out which MIPS ABI is in use.  */
+
+static void
+show_mips_abi (char *ignore_args, int from_tty)
+{
+  if (gdbarch_bfd_arch_info (current_gdbarch)->arch != bfd_arch_mips)
+    printf_filtered (
+      "The MIPS ABI is unknown because the current architecture is not MIPS.\n");
+  else
+    {
+      enum mips_abi global_abi = global_mips_abi ();
+      enum mips_abi actual_abi = mips_abi (current_gdbarch);
+      const char *actual_abi_str = mips_abi_strings[actual_abi];
+
+      if (global_abi == MIPS_ABI_UNKNOWN)
+	printf_filtered ("The MIPS ABI is set automatically (currently \"%s\").\n",
+	                 actual_abi_str);
+      else if (global_abi == actual_abi)
+	printf_filtered (
+	  "The MIPS ABI is assumed to be \"%s\" (due to user setting).\n",
+	  actual_abi_str);
+      else
+	{
+	  /* Probably shouldn't happen...  */
+	  printf_filtered (
+	    "The (auto detected) MIPS ABI \"%s\" is in use even though the user setting was \"%s\".\n",
+	    actual_abi_str,
+	    mips_abi_strings[global_abi]);
+	}
+    }
+}
+
 static void
 mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
 {
@@ -6513,8 +6545,9 @@ This option can be set to one of:\n\
      "  eabi32\n"
      "  eabi64",
      &setmipscmdlist);
-  add_show_from_set (c, &showmipscmdlist);
   set_cmd_sfunc (c, mips_abi_update);
+  add_cmd ("abi", class_obscure, show_mips_abi,
+           "Show ABI in use by MIPS target", &showmipscmdlist);
 
   /* Let the user turn off floating point and set the fence post for
      heuristic_proc_start.  */


  parent reply	other threads:[~2003-02-27  1:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-26  2:41 Kevin Buettner
2003-02-26  3:10 ` Daniel Jacobowitz
2003-02-26 21:29 ` Andrew Cagney
     [not found]   ` <mailpost.1046294979.10353@news-sj1-1>
2003-02-26 22:32     ` cgd
2003-02-26 23:04       ` Andrew Cagney
2003-02-27  1:33   ` Kevin Buettner [this message]
2003-02-27  2:18     ` 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=1030227013326.ZM24848@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=cgd@broadcom.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