From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25664 invoked by alias); 26 Feb 2003 02:41:26 -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 25657 invoked from network); 26 Feb 2003 02:41:25 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 26 Feb 2003 02:41:25 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h1Q2fPe08105 for ; Tue, 25 Feb 2003 21:41:25 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h1Q2fPq21726 for ; Tue, 25 Feb 2003 21:41:25 -0500 Received: from localhost.localdomain (vpn50-20.rdu.redhat.com [172.16.50.20]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h1Q2fOJ04345 for ; Tue, 25 Feb 2003 21:41:24 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h1Q2fJL14582 for gdb-patches@sources.redhat.com; Tue, 25 Feb 2003 19:41:19 -0700 Date: Wed, 26 Feb 2003 02:41:00 -0000 From: Kevin Buettner Message-Id: <1030226024118.ZM14581@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFA] mips-tdep.c: Make ``show mips abi'' more useful MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-02/txt/msg00690.txt.bz2 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. */