diff options
author | Andrew Cagney <cagney@redhat.com> | 1998-12-14 02:37:16 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1998-12-14 02:37:16 +0000 |
commit | f7e85b1bc11e564d356933c447070a55ff5fa56d (patch) | |
tree | 676c86e49ebbc3c02e29a16a41cfb7a6ab77138b /gdb/top.c | |
parent | aaa3c096db1beebb67015bc8711cf908f7f2559b (diff) | |
download | gdb-f7e85b1bc11e564d356933c447070a55ff5fa56d.zip gdb-f7e85b1bc11e564d356933c447070a55ff5fa56d.tar.gz gdb-f7e85b1bc11e564d356933c447070a55ff5fa56d.tar.bz2 |
CARP:
Consolidate the semi-dynamic target system dependant GDB parameters
moving them all into a new file.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 293 |
1 files changed, 0 insertions, 293 deletions
@@ -108,22 +108,6 @@ static void init_signals PARAMS ((void)); static void set_verbose PARAMS ((char *, int, struct cmd_list_element *)); -static void set_endian PARAMS ((char *, int)); - -static void set_endian_big PARAMS ((char *, int)); - -static void set_endian_little PARAMS ((char *, int)); - -static void set_endian_auto PARAMS ((char *, int)); - -static void show_endian PARAMS ((char *, int)); - -static void set_architecture PARAMS ((char *, int)); - -static void show_architecture PARAMS ((char *, int)); - -static void info_architecture PARAMS ((char *, int)); - static void show_history PARAMS ((char *, int)); static void set_history PARAMS ((char *, int)); @@ -239,10 +223,6 @@ struct cmd_list_element *unsetlist; struct cmd_list_element *showlist; -/* Chain containing the \"set endian\" commands. */ - -struct cmd_list_element *endianlist; - /* Chain containing all defined \"set history\". */ struct cmd_list_element *sethistlist; @@ -3197,257 +3177,6 @@ dont_repeat_command (ignored, from_tty) necessarily reading from stdin. */ } -/* Functions to manipulate the endianness of the target. */ - -#ifdef TARGET_BYTE_ORDER_SELECTABLE -/* compat - Catch old targets that expect a selectable byte-order to - default to BIG_ENDIAN */ -#ifndef TARGET_BYTE_ORDER_DEFAULT -#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN -#endif -#endif -#ifndef TARGET_BYTE_ORDER_DEFAULT -/* compat - Catch old non byte-order selectable targets that do not - define TARGET_BYTE_ORDER_DEFAULT and instead expect - TARGET_BYTE_ORDER to be used as the default. For targets that - defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the - below will get a strange compiler warning. */ -#define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER -#endif -int target_byte_order = TARGET_BYTE_ORDER_DEFAULT; -int target_byte_order_auto = 1; - -/* Called if the user enters ``set endian'' without an argument. */ -static void -set_endian (args, from_tty) - char *args; - int from_tty; -{ - printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n"); - show_endian (args, from_tty); -} - -/* Called by ``set endian big''. */ -static void -set_endian_big (args, from_tty) - char *args; - int from_tty; -{ - if (TARGET_BYTE_ORDER_SELECTABLE_P) - { - target_byte_order = BIG_ENDIAN; - target_byte_order_auto = 0; - } - else - { - printf_unfiltered ("Byte order is not selectable."); - show_endian (args, from_tty); - } -} - -/* Called by ``set endian little''. */ -static void -set_endian_little (args, from_tty) - char *args; - int from_tty; -{ - if (TARGET_BYTE_ORDER_SELECTABLE_P) - { - target_byte_order = LITTLE_ENDIAN; - target_byte_order_auto = 0; - } - else - { - printf_unfiltered ("Byte order is not selectable."); - show_endian (args, from_tty); - } -} - -/* Called by ``set endian auto''. */ -static void -set_endian_auto (args, from_tty) - char *args; - int from_tty; -{ - if (TARGET_BYTE_ORDER_SELECTABLE_P) - { - target_byte_order_auto = 1; - } - else - { - printf_unfiltered ("Byte order is not selectable."); - show_endian (args, from_tty); - } -} - -/* Called by ``show endian''. */ -static void -show_endian (args, from_tty) - char *args; - int from_tty; -{ - char *msg = - (TARGET_BYTE_ORDER_AUTO - ? "The target endianness is set automatically (currently %s endian)\n" - : "The target is assumed to be %s endian\n"); - printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little")); -} - -/* Set the endianness from a BFD. */ -void -set_endian_from_file (abfd) - bfd *abfd; -{ - if (TARGET_BYTE_ORDER_SELECTABLE_P) - { - int want; - - if (bfd_big_endian (abfd)) - want = BIG_ENDIAN; - else - want = LITTLE_ENDIAN; - if (TARGET_BYTE_ORDER_AUTO) - target_byte_order = want; - else if (TARGET_BYTE_ORDER != want) - warning ("%s endian file does not match %s endian target.", - want == BIG_ENDIAN ? "big" : "little", - TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"); - } - else - { - if (bfd_big_endian (abfd) - ? TARGET_BYTE_ORDER != BIG_ENDIAN - : TARGET_BYTE_ORDER == BIG_ENDIAN) - warning ("%s endian file does not match %s endian target.", - bfd_big_endian (abfd) ? "big" : "little", - TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"); - } -} - -/* Functions to manipulate the architecture of the target */ - -int target_architecture_auto = 1; -extern const bfd_arch_info_type bfd_default_arch_struct; -const bfd_arch_info_type *target_architecture = &bfd_default_arch_struct; -int (*target_architecture_hook) PARAMS ((const bfd_arch_info_type *ap)); - -static void -set_arch (arch) - const bfd_arch_info_type *arch; -{ - /* FIXME: Is it compatible with gdb? */ - /* Check with the target on the setting */ - if (target_architecture_hook != NULL - && !target_architecture_hook (arch)) - printf_unfiltered ("Target does not support `%s' architecture.\n", - arch->printable_name); - else - { - target_architecture_auto = 0; - target_architecture = arch; - } -} - - -/* Called if the user enters ``set architecture'' with or without an - argument. */ -static void -set_architecture (args, from_tty) - char *args; - int from_tty; -{ - if (args == NULL) - { - printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n"); - } - else if (strcmp (args, "auto") == 0) - { - target_architecture_auto = 1; - } - else - { - const bfd_arch_info_type *arch = bfd_scan_arch (args); - if (arch != NULL) - set_arch (arch); - else - printf_unfiltered ("Architecture `%s' not reconized.\n", args); - } -} - -/* Called if the user enters ``show architecture'' without an argument. */ -static void -show_architecture (args, from_tty) - char *args; - int from_tty; -{ - const char *arch; - arch = target_architecture->printable_name; - if (target_architecture_auto) - printf_filtered ("The target architecture is set automatically (currently %s)\n", arch); - else - printf_filtered ("The target architecture is assumed to be %s\n", arch); -} - -/* Called if the user enters ``info architecture'' without an argument. */ -static void -info_architecture (args, from_tty) - char *args; - int from_tty; -{ - enum bfd_architecture a; - printf_filtered ("Available architectures are:\n"); - for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) - { - const bfd_arch_info_type *ap = bfd_lookup_arch (a, 0); - if (ap != NULL) - { - do - { - printf_filtered (" %s", ap->printable_name); - ap = ap->next; - } - while (ap != NULL); - printf_filtered ("\n"); - } - } -} - -/* Set the architecture from arch/machine */ -void -set_architecture_from_arch_mach (arch, mach) - enum bfd_architecture arch; - unsigned long mach; -{ - const bfd_arch_info_type *wanted = bfd_lookup_arch (arch, mach); - if (wanted != NULL) - set_arch (wanted); - else - fatal ("hardwired architecture/machine not reconized"); -} - - -/* Set the architecture from a BFD */ -void -set_architecture_from_file (abfd) - bfd *abfd; -{ - const bfd_arch_info_type *wanted = bfd_get_arch_info (abfd); - if (target_architecture_auto) - { - if (target_architecture_hook != NULL - && !target_architecture_hook (wanted)) - warning ("Target may not support %s architecture", - wanted->printable_name); - target_architecture = wanted; - } - else if (wanted != target_architecture) - { - warning ("%s architecture file may be incompatible with %s target.", - wanted->printable_name, - target_architecture->printable_name); - } -} - /* Functions to manipulate command line editing control variables. */ /* Number of commands to print in each call to show_commands. */ @@ -3617,7 +3346,6 @@ init_cmd_lists () setlist = NULL; unsetlist = NULL; showlist = NULL; - endianlist = NULL; sethistlist = NULL; showhistlist = NULL; unsethistlist = NULL; @@ -3668,27 +3396,6 @@ init_main () { struct cmd_list_element *c; - add_prefix_cmd ("endian", class_support, set_endian, - "Set endianness of target.", - &endianlist, "set endian ", 0, &setlist); - add_cmd ("big", class_support, set_endian_big, - "Set target as being big endian.", &endianlist); - add_cmd ("little", class_support, set_endian_little, - "Set target as being little endian.", &endianlist); - add_cmd ("auto", class_support, set_endian_auto, - "Select target endianness automatically.", &endianlist); - add_cmd ("endian", class_support, show_endian, - "Show endianness of target.", &showlist); - - add_cmd ("architecture", class_support, set_architecture, - "Set architecture of target.", &setlist); - add_alias_cmd ("processor", "architecture", class_support, 1, &setlist); - add_cmd ("architecture", class_support, show_architecture, - "Show architecture of target.", &showlist); - add_cmd ("architecture", class_support, info_architecture, - "List supported target architectures", &infolist); - - #ifdef DEFAULT_PROMPT prompt = savestring (DEFAULT_PROMPT, strlen(DEFAULT_PROMPT)); #else |