* [RFA] mips-tdep.c: Make ``show mips abi'' more useful
@ 2003-02-26 2:41 Kevin Buettner
2003-02-26 3:10 ` Daniel Jacobowitz
2003-02-26 21:29 ` Andrew Cagney
0 siblings, 2 replies; 7+ messages in thread
From: Kevin Buettner @ 2003-02-26 2:41 UTC (permalink / raw)
To: gdb-patches
By default, the command ``show mips abi'' will print the following:
The ABI used by this program is "auto".
This information is not as useful as it could be. In such cases, it
would also be nice to know what GDB has determined the actual ABI to
be. The patch below adds a callback to augment the information provided
by the ``show mips abi command''. E.g,
(gdb) file hello-n64-shared
Reading symbols from hello-n64-shared...done.
(gdb) show mips abi
The ABI used by this program is "auto".
Current ABI is "n64".
Okay?
(BTW, ``show language'' and some other commands in language.c use a
similar mechanism for providing additional information. It might
be cleaner though to implement ``show mips abi'' in a fashion similar
to the way that ``show osabi'' is implemented.)
* mips-tdep.c (mips_abi_show): New function.
(_initialize_mips_tdep): Add callback for ``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 26 Feb 2003 02:29:04 -0000
@@ -6066,6 +6066,26 @@ mips_abi_update (char *ignore_args, int
gdbarch_update_p (info);
}
+/* Callback for command ``show mips abi''. Print out which ABI is in
+ use when the global mips abi is set to "auto". */
+
+static void
+mips_abi_show (char *ignore_args, int from_tty,
+ struct cmd_list_element *c)
+{
+ if (global_mips_abi () == MIPS_ABI_UNKNOWN
+ && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips)
+ {
+ enum mips_abi abi = mips_abi (current_gdbarch);
+ const char *abi_str;
+ if (abi == MIPS_ABI_UNKNOWN)
+ abi_str = "unknown";
+ else
+ abi_str = mips_abi_strings[abi];
+ fprintf_filtered (gdb_stdout, "Current ABI is \"%s\".\n", abi_str);
+ }
+}
+
static void
mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
{
@@ -6451,7 +6471,7 @@ void
_initialize_mips_tdep (void)
{
static struct cmd_list_element *mipsfpulist = NULL;
- struct cmd_list_element *c;
+ struct cmd_list_element *c, *c2;
mips_abi_string = mips_abi_strings [MIPS_ABI_UNKNOWN];
if (MIPS_ABI_LAST + 1
@@ -6513,8 +6533,9 @@ This option can be set to one of:\n\
" eabi32\n"
" eabi64",
&setmipscmdlist);
- add_show_from_set (c, &showmipscmdlist);
+ c2 = add_show_from_set (c, &showmipscmdlist);
set_cmd_sfunc (c, mips_abi_update);
+ set_cmd_sfunc (c2, mips_abi_show);
/* Let the user turn off floating point and set the fence post for
heuristic_proc_start. */
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
2003-02-26 2:41 [RFA] mips-tdep.c: Make ``show mips abi'' more useful Kevin Buettner
@ 2003-02-26 3:10 ` Daniel Jacobowitz
2003-02-26 21:29 ` Andrew Cagney
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-02-26 3:10 UTC (permalink / raw)
To: gdb-patches
On Tue, Feb 25, 2003 at 07:41:19PM -0700, Kevin Buettner wrote:
> By default, the command ``show mips abi'' will print the following:
>
> The ABI used by this program is "auto".
>
> This information is not as useful as it could be. In such cases, it
> would also be nice to know what GDB has determined the actual ABI to
> be. The patch below adds a callback to augment the information provided
> by the ``show mips abi command''. E.g,
>
> (gdb) file hello-n64-shared
> Reading symbols from hello-n64-shared...done.
> (gdb) show mips abi
> The ABI used by this program is "auto".
> Current ABI is "n64".
>
> Okay?
>
> (BTW, ``show language'' and some other commands in language.c use a
> similar mechanism for providing additional information. It might
> be cleaner though to implement ``show mips abi'' in a fashion similar
> to the way that ``show osabi'' is implemented.)
I get the impression we need a standard mechanism for this sort of
variable - they just keep cropping up all over the place.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
2003-02-26 2:41 [RFA] mips-tdep.c: Make ``show mips abi'' more useful 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-27 1:33 ` Kevin Buettner
1 sibling, 2 replies; 7+ messages in thread
From: Andrew Cagney @ 2003-02-26 21:29 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> By default, the command ``show mips abi'' will print the following:
>
> The ABI used by this program is "auto".
>
> This information is not as useful as it could be. In such cases, it
> would also be nice to know what GDB has determined the actual ABI to
> be. The patch below adds a callback to augment the information provided
> by the ``show mips abi command''. E.g,
>
> (gdb) file hello-n64-shared
> Reading symbols from hello-n64-shared...done.
> (gdb) show mips abi
> The ABI used by this program is "auto".
> Current ABI is "n64".
>
> Okay?
Oops! The new output, though, is still confusing. For remote.c's
packet commands it outputs either of:
Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.
Support for remote protocol `%s' (%s) packet is currently %s.
which I think is much clearer. Can you just change the messages to
something more like that before committing?
Andrew
> (BTW, ``show language'' and some other commands in language.c use a
> similar mechanism for providing additional information. It might
> be cleaner though to implement ``show mips abi'' in a fashion similar
> to the way that ``show osabi'' is implemented.)
>
> * mips-tdep.c (mips_abi_show): New function.
> (_initialize_mips_tdep): Add callback for ``show mips abi''.
>
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <mailpost.1046294979.10353@news-sj1-1>]
* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
[not found] ` <mailpost.1046294979.10353@news-sj1-1>
@ 2003-02-26 22:32 ` cgd
2003-02-26 23:04 ` Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: cgd @ 2003-02-26 22:32 UTC (permalink / raw)
To: ac131313; +Cc: Kevin Buettner, gdb-patches
At Wed, 26 Feb 2003 21:29:39 +0000 (UTC), "Andrew Cagney" wrote:
> Oops! The new output, though, is still confusing. For remote.c's
> packet commands it outputs either of:
>
> Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.
> Support for remote protocol `%s' (%s) packet is currently %s.
>
> which I think is much clearer. Can you just change the messages to
> something more like that before committing?
FWIW, 'show architecture' says:
(gdb) show architecture
The target architecture is set automatically (currently mips:8000)
which i find very pretty. 8-)
if you actually force it, it says:
(gdb) set architecture mips:8000
The target architecture is assumed to be mips:8000
(gdb) show architecture
The target architecture is assumed to be mips:8000
and back to auto:
(gdb) set architecture auto
The target architecture is set automatically (currently mips:8000)
8-)
chris
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
2003-02-26 22:32 ` cgd
@ 2003-02-26 23:04 ` Andrew Cagney
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2003-02-26 23:04 UTC (permalink / raw)
To: cgd, Kevin Buettner; +Cc: gdb-patches
> At Wed, 26 Feb 2003 21:29:39 +0000 (UTC), "Andrew Cagney" wrote:
>
>> Oops! The new output, though, is still confusing. For remote.c's
>> packet commands it outputs either of:
>>
>> Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.
>> Support for remote protocol `%s' (%s) packet is currently %s.
>>
>> which I think is much clearer. Can you just change the messages to
>> something more like that before committing?
Or like the below :-)
> FWIW, 'show architecture' says:
>
> (gdb) show architecture
> The target architecture is set automatically (currently mips:8000)
>
> which i find very pretty. 8-)
>
> if you actually force it, it says:
>
> (gdb) set architecture mips:8000
> The target architecture is assumed to be mips:8000
> (gdb) show architecture
> The target architecture is assumed to be mips:8000
>
> and back to auto:
>
> (gdb) set architecture auto
> The target architecture is set automatically (currently mips:8000)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
2003-02-26 21:29 ` Andrew Cagney
[not found] ` <mailpost.1046294979.10353@news-sj1-1>
@ 2003-02-27 1:33 ` Kevin Buettner
2003-02-27 2:18 ` Andrew Cagney
1 sibling, 1 reply; 7+ messages in thread
From: Kevin Buettner @ 2003-02-27 1:33 UTC (permalink / raw)
To: Andrew Cagney; +Cc: cgd, gdb-patches
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. */
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful
2003-02-27 1:33 ` Kevin Buettner
@ 2003-02-27 2:18 ` Andrew Cagney
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2003-02-27 2:18 UTC (permalink / raw)
To: Kevin Buettner; +Cc: cgd, gdb-patches
> (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").
I'll assume that this is in.
Thanks!
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-02-27 2:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-26 2:41 [RFA] mips-tdep.c: Make ``show mips abi'' more useful 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
2003-02-27 2:18 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox