From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29444 invoked by alias); 27 Feb 2003 01:33:34 -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 29437 invoked from network); 27 Feb 2003 01:33:34 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 27 Feb 2003 01:33:34 -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 h1R1XXe24573 for ; Wed, 26 Feb 2003 20:33:33 -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 h1R1XWq02902; Wed, 26 Feb 2003 20:33:32 -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 h1R1XWc03149; Wed, 26 Feb 2003 20:33:32 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h1R1XQp24849; Wed, 26 Feb 2003 18:33:26 -0700 Date: Thu, 27 Feb 2003 01:33:00 -0000 From: Kevin Buettner Message-Id: <1030227013326.ZM24848@localhost.localdomain> In-Reply-To: Andrew Cagney "Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful" (Feb 26, 4:31pm) References: <1030226024118.ZM14581@localhost.localdomain> <3E5D3242.5080104@redhat.com> To: Andrew Cagney Subject: Re: [RFA] mips-tdep.c: Make ``show mips abi'' more useful Cc: cgd@broadcom.com, gdb-patches@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-02/txt/msg00760.txt.bz2 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. */