aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/mips-tdep.c126
2 files changed, 134 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 298843f..fc0e6c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@
+Sun Apr 9 23:42:16 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ From 2000-04-07 Jonathan Larmour <jlarmour@redhat.co.uk>:
+ * mips-tdep.c (saved_gpreg_size_enums): Define enum command for
+ new "set mips saved-gpreg-size" command
+ (MIPS_SAVED_REGSIZE): Now a function mips_saved_regsize()
+ (MIPS_DEFAULT_SAVED_REGSIZE): Define for default MIPS_SAVED_REGSIZE,
+ either from target, or gdb multi-arch
+ (show_mips_command): New. For "show mips" prefix command
+ (set_mips_command): New. For "show mips" prefix command
+ (_initialize_mips_tdep): Add top-level mips prefix command
+ Add "set mips saved-gpreg-size" command
+
+ * mips-tdep.c (struct gdbarch_tdep): Rename mips_saved_regsize to
+ mips_default_saved_regsize.
+ (mips_gdbarch_init): Update.
+ (MIPS_DEFAULT_SAVED_REGSIZE): Update.
+ (mips_gdbarch_init): Use MIPS_REGSIZE as the default value for
+ mips_default_saved_regsize.
+
Sun Apr 9 23:27:00 2000 Andrew Cagney <cagney@b1.cygnus.com>
From 2000-04-07 J.T. Conklin <jtc@redback.com>:
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 092ae34..71b3482 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -45,6 +45,22 @@ struct frame_extra_info
int num_args;
};
+/* We allow the user to override MIPS_SAVED_REGSIZE, so define
+ the subcommand enum settings allowed. */
+static char saved_gpreg_size_auto[] = "auto";
+static char saved_gpreg_size_32[] = "32";
+static char saved_gpreg_size_64[] = "64";
+
+static char *saved_gpreg_size_enums[] = {
+ saved_gpreg_size_auto,
+ saved_gpreg_size_32,
+ saved_gpreg_size_64,
+ 0
+};
+
+/* The current (string) value of saved_gpreg_size. */
+static char *mips_saved_regsize_string = saved_gpreg_size_auto;
+
/* Some MIPS boards don't support floating point while others only
support single-precision floating-point operations. See also
FP_REGISTER_DOUBLE. */
@@ -63,10 +79,12 @@ static int mips_fpu_type_auto = 1;
static enum mips_fpu_type mips_fpu_type = MIPS_DEFAULT_FPU_TYPE;
#define MIPS_FPU_TYPE mips_fpu_type
-#ifndef MIPS_SAVED_REGSIZE
-#define MIPS_SAVED_REGSIZE MIPS_REGSIZE
+#ifndef MIPS_DEFAULT_SAVED_REGSIZE
+#define MIPS_DEFAULT_SAVED_REGSIZE MIPS_REGSIZE
#endif
+#define MIPS_SAVED_REGSIZE (mips_saved_regsize())
+
/* Do not use "TARGET_IS_MIPS64" to test the size of floating point registers */
#ifndef FP_REGISTER_DOUBLE
#define FP_REGISTER_DOUBLE (REGISTER_VIRTUAL_SIZE(FP0_REGNUM) == 8)
@@ -83,7 +101,7 @@ struct gdbarch_tdep
enum mips_fpu_type mips_fpu_type;
int mips_last_arg_regnum;
int mips_last_fp_arg_regnum;
- int mips_saved_regsize;
+ int mips_default_saved_regsize;
int mips_fp_register_double;
};
@@ -108,8 +126,8 @@ struct gdbarch_tdep
#endif
#if GDB_MULTI_ARCH
-#undef MIPS_SAVED_REGSIZE
-#define MIPS_SAVED_REGSIZE (gdbarch_tdep (current_gdbarch)->mips_saved_regsize)
+#undef MIPS_DEFAULT_SAVED_REGSIZE
+#define MIPS_DEFAULT_SAVED_REGSIZE (gdbarch_tdep (current_gdbarch)->mips_default_saved_regsize)
#endif
/* Indicate that the ABI makes use of double-precision registers
@@ -166,6 +184,10 @@ char *tmp_mips_processor_type;
char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
char **mips_processor_reg_names = mips_generic_reg_names;
+/* The list of available "set mips " and "show mips " commands */
+static struct cmd_list_element *setmipscmdlist = NULL;
+static struct cmd_list_element *showmipscmdlist = NULL;
+
char *
mips_register_name (i)
int i;
@@ -303,6 +325,19 @@ mips_print_extra_frame_info (fi)
paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
}
+/* Return the currently configured (or set) saved register size */
+
+static unsigned int
+mips_saved_regsize ()
+{
+ if (mips_saved_regsize_string == saved_gpreg_size_auto)
+ return MIPS_DEFAULT_SAVED_REGSIZE;
+ else if (mips_saved_regsize_string == saved_gpreg_size_64)
+ return 8;
+ else /* if (mips_saved_regsize_string == saved_gpreg_size_32) */
+ return 4;
+}
+
/* Convert between RAW and VIRTUAL registers. The RAW register size
defines the remote-gdb packet. */
@@ -3144,6 +3179,28 @@ in_sigtramp (pc, ignore)
return (pc >= sigtramp_address && pc < sigtramp_end);
}
+/* Root of all "set mips "/"show mips " commands. This will eventually be
+ used for all MIPS-specific commands. */
+
+static void show_mips_command PARAMS ((char *, int));
+static void
+show_mips_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ help_list (showmipscmdlist, "show mips ", all_commands, gdb_stdout);
+}
+
+static void set_mips_command PARAMS ((char *, int));
+static void
+set_mips_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ printf_unfiltered ("\"set mips\" must be followed by an appropriate subcommand.\n");
+ help_list (setmipscmdlist, "set mips ", all_commands, gdb_stdout);
+}
+
/* Commands to show/set the MIPS FPU type. */
static void show_mipsfpu_command PARAMS ((char *, int));
@@ -3708,7 +3765,7 @@ mips_gdbarch_init (info, arches)
case E_MIPS_ABI_O32:
ef_mips_abi = "o32";
tdep->mips_eabi = 0;
- tdep->mips_saved_regsize = 4;
+ tdep->mips_default_saved_regsize = 4;
tdep->mips_fp_register_double = 0;
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 32);
@@ -3717,7 +3774,7 @@ mips_gdbarch_init (info, arches)
case E_MIPS_ABI_O64:
ef_mips_abi = "o64";
tdep->mips_eabi = 0;
- tdep->mips_saved_regsize = 8;
+ tdep->mips_default_saved_regsize = 8;
tdep->mips_fp_register_double = 1;
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 32);
@@ -3726,7 +3783,7 @@ mips_gdbarch_init (info, arches)
case E_MIPS_ABI_EABI32:
ef_mips_abi = "eabi32";
tdep->mips_eabi = 1;
- tdep->mips_saved_regsize = 4;
+ tdep->mips_default_saved_regsize = 4;
tdep->mips_fp_register_double = 0;
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 32);
@@ -3735,7 +3792,7 @@ mips_gdbarch_init (info, arches)
case E_MIPS_ABI_EABI64:
ef_mips_abi = "eabi64";
tdep->mips_eabi = 1;
- tdep->mips_saved_regsize = 8;
+ tdep->mips_default_saved_regsize = 8;
tdep->mips_fp_register_double = 1;
set_gdbarch_long_bit (gdbarch, 64);
set_gdbarch_ptr_bit (gdbarch, 64);
@@ -3744,7 +3801,7 @@ mips_gdbarch_init (info, arches)
default:
ef_mips_abi = "default";
tdep->mips_eabi = 0;
- tdep->mips_saved_regsize = MIPS_REGSIZE;
+ tdep->mips_default_saved_regsize = MIPS_REGSIZE;
tdep->mips_fp_register_double = (REGISTER_VIRTUAL_SIZE (FP0_REGNUM) == 8);
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 32);
@@ -3752,6 +3809,27 @@ mips_gdbarch_init (info, arches)
break;
}
+ /* FIXME: jlarmour/2000-04-07: There *is* a flag EF_MIPS_32BIT_MODE
+ that could indicate -gp32 BUT gas/config/tc-mips.c contains the
+ comment:
+
+ ``We deliberately don't allow "-gp32" to set the MIPS_32BITMODE
+ flag in object files because to do so would make it impossible to
+ link with libraries compiled without "-gp32". This is
+ unnecessarily restrictive.
+
+ We could solve this problem by adding "-gp32" multilibs to gcc,
+ but to set this flag before gcc is built with such multilibs will
+ break too many systems.''
+
+ But even more unhelpfully, the default linker output target for
+ mips64-elf is elf32-bigmips, and has EF_MIPS_32BIT_MODE set, even
+ for 64-bit programs - you need to change the ABI to change this,
+ and not all gcc targets support that currently. Therefore using
+ this flag to detect 32-bit mode would do the wrong thing given
+ the current gcc - it would make GDB treat these 64-bit programs
+ as 32-bit programs by default. */
+
/* determine the ISA */
switch (elf_flags & EF_MIPS_ARCH)
{
@@ -3890,8 +3968,8 @@ mips_gdbarch_init (info, arches)
: tdep->mips_fpu_type == MIPS_FPU_DOUBLE ? "double"
: "???"));
fprintf_unfiltered (gdb_stderr,
- "mips_gdbarch_init: tdep->mips_saved_regsize = %d\n",
- tdep->mips_saved_regsize);
+ "mips_gdbarch_init: tdep->mips_default_saved_regsize = %d\n",
+ tdep->mips_default_saved_regsize);
fprintf_unfiltered (gdb_stderr,
"mips_gdbarch_init: tdep->mips_fp_register_double = %d (%s)\n",
tdep->mips_fp_register_double,
@@ -3913,6 +3991,30 @@ _initialize_mips_tdep ()
if (!tm_print_insn) /* Someone may have already set it */
tm_print_insn = gdb_print_insn_mips;
+ /* Add root prefix command for all "set mips"/"show mips" commands */
+ add_prefix_cmd ("mips", no_class, set_mips_command,
+ "Various MIPS specific commands.",
+ &setmipscmdlist, "set mips ", 0, &setlist);
+
+ add_prefix_cmd ("mips", no_class, show_mips_command,
+ "Various MIPS specific commands.",
+ &showmipscmdlist, "show mips ", 0, &showlist);
+
+ /* Allow the user to override the saved register size. */
+ add_show_from_set (add_set_enum_cmd ("saved-gpreg-size",
+ class_obscure,
+ saved_gpreg_size_enums,
+ (char *) &mips_saved_regsize_string, "\
+Set size of general purpose registers saved on the stack.\n\
+This option can be set to one of:\n\
+ 32 - Force GDB to treat saved GP registers as 32-bit\n\
+ 64 - Force GDB to treat saved GP registers as 64-bit\n\
+ auto - Allow GDB to use the target's default setting or autodetect the\n\
+ saved GP register size from information contained in the executable.\n\
+ (default: auto)",
+ &setmipscmdlist),
+ &showmipscmdlist);
+
/* Let the user turn off floating point and set the fence post for
heuristic_proc_start. */