aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-06-10 05:37:47 +0000
committerAndrew Cagney <cagney@redhat.com>2000-06-10 05:37:47 +0000
commit4b9b395931f9b9ed5bff797fad1e128fe9da136b (patch)
tree5fc33561e02978b777ebd0105af0d555347d7831 /gdb/mips-tdep.c
parentdee8b1a1c52bb43245e6b0ac2958ea6de4f6ba29 (diff)
downloadgdb-4b9b395931f9b9ed5bff797fad1e128fe9da136b.zip
gdb-4b9b395931f9b9ed5bff797fad1e128fe9da136b.tar.gz
gdb-4b9b395931f9b9ed5bff797fad1e128fe9da136b.tar.bz2
Re-implement gdbach_dump() so that it prints out the macro values.
Add ``maint print arch'' command. Add ``gdbarch_register()'' function that also takes gdbarch_dump_tdep(). Use in mips-tdep.c.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c134
1 files changed, 76 insertions, 58 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index fd77607..0ccb861 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3840,7 +3840,6 @@ mips_gdbarch_init (info, arches)
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int elf_flags;
- char *ef_mips_abi;
int ef_mips_bitptrs;
int ef_mips_arch;
enum mips_abi mips_abi;
@@ -3891,8 +3890,22 @@ mips_gdbarch_init (info, arches)
if (mips_abi == MIPS_ABI_UNKNOWN)
mips_abi = MIPS_DEFAULT_ABI;
#endif
- if (mips_abi == MIPS_ABI_UNKNOWN)
- mips_abi = MIPS_ABI_O32;
+
+ if (gdbarch_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "mips_gdbarch_init: elf_flags = %08x\n",
+ elf_flags);
+ fprintf_unfiltered (gdb_stdlog,
+ "mips_gdbarch_init: ef_mips_arch = %d\n",
+ ef_mips_arch);
+ fprintf_unfiltered (gdb_stdlog,
+ "mips_gdbarch_init: ef_mips_bitptrs = %d\n",
+ ef_mips_bitptrs);
+ fprintf_unfiltered (gdb_stdlog,
+ "mips_gdbarch_init: mips_abi = %d\n",
+ mips_abi);
+ }
/* try to find a pre-existing architecture */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -3923,7 +3936,6 @@ mips_gdbarch_init (info, arches)
switch (mips_abi)
{
case MIPS_ABI_O32:
- ef_mips_abi = "o32";
tdep->mips_default_saved_regsize = 4;
tdep->mips_default_stack_argsize = 4;
tdep->mips_fp_register_double = 0;
@@ -3935,7 +3947,6 @@ mips_gdbarch_init (info, arches)
set_gdbarch_long_long_bit (gdbarch, 64);
break;
case MIPS_ABI_O64:
- ef_mips_abi = "o64";
tdep->mips_default_saved_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
@@ -3947,7 +3958,6 @@ mips_gdbarch_init (info, arches)
set_gdbarch_long_long_bit (gdbarch, 64);
break;
case MIPS_ABI_EABI32:
- ef_mips_abi = "eabi32";
tdep->mips_default_saved_regsize = 4;
tdep->mips_default_stack_argsize = 4;
tdep->mips_fp_register_double = 0;
@@ -3959,7 +3969,6 @@ mips_gdbarch_init (info, arches)
set_gdbarch_long_long_bit (gdbarch, 64);
break;
case MIPS_ABI_EABI64:
- ef_mips_abi = "eabi64";
tdep->mips_default_saved_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
@@ -3971,7 +3980,6 @@ mips_gdbarch_init (info, arches)
set_gdbarch_long_long_bit (gdbarch, 64);
break;
case MIPS_ABI_N32:
- ef_mips_abi = "n32";
tdep->mips_default_saved_regsize = 4;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
@@ -3983,7 +3991,6 @@ mips_gdbarch_init (info, arches)
set_gdbarch_long_long_bit (gdbarch, 64);
break;
default:
- ef_mips_abi = "default";
tdep->mips_default_saved_regsize = MIPS_REGSIZE;
tdep->mips_default_stack_argsize = MIPS_REGSIZE;
tdep->mips_fp_register_double = (REGISTER_VIRTUAL_SIZE (FP0_REGNUM) == 8);
@@ -4111,67 +4118,78 @@ mips_gdbarch_init (info, arches)
set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
set_gdbarch_get_saved_register (gdbarch, mips_get_saved_register);
- if (gdbarch_debug)
+ return gdbarch;
+}
+
+static void
+mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ if (tdep != NULL)
{
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: (info)ef_mips_abi = %s\n",
- ef_mips_abi);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: (info)ef_mips_arch = %d\n",
- ef_mips_arch);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: (info)ef_mips_bitptrs = %d\n",
- ef_mips_bitptrs);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: MIPS_REGSIZE = %d\n",
- MIPS_REGSIZE);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->elf_flags = 0x%x\n",
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: tdep->elf_flags = 0x%x\n",
tdep->elf_flags);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_abi = %d\n",
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: tdep->mips_abi = %d\n",
tdep->mips_abi);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_fpu_type = %d (%s)\n",
- tdep->mips_fpu_type,
- (tdep->mips_fpu_type == MIPS_FPU_NONE ? "none"
- : tdep->mips_fpu_type == MIPS_FPU_SINGLE ? "single"
- : tdep->mips_fpu_type == MIPS_FPU_DOUBLE ? "double"
- : "???"));
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_last_arg_regnum = %d\n",
- tdep->mips_last_arg_regnum);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_last_fp_arg_regnum = %d (%d)\n",
- tdep->mips_last_fp_arg_regnum,
- tdep->mips_last_fp_arg_regnum - FP0_REGNUM);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_default_saved_regsize = %d\n",
- tdep->mips_default_saved_regsize);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_fp_register_double = %d (%s)\n",
- tdep->mips_fp_register_double,
- (tdep->mips_fp_register_double ? "true" : "false"));
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_regs_have_home_p = %d\n",
- tdep->mips_regs_have_home_p);
- fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: tdep->mips_default_stack_argsize = %d\n",
- tdep->mips_default_stack_argsize);
}
-
- return gdbarch;
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: FP_REGISTER_DOUBLE = %d\n",
+ FP_REGISTER_DOUBLE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
+ MIPS_DEFAULT_FPU_TYPE,
+ (MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_NONE ? "none"
+ : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
+ : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
+ : "???"));
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_EABI = %d\n",
+ MIPS_EABI);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_LAST_FP_ARG_REGNUM = %d\n",
+ MIPS_LAST_FP_ARG_REGNUM);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_LAST_ARG_REGNUM = %d\n",
+ MIPS_LAST_ARG_REGNUM);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
+ MIPS_FPU_TYPE,
+ (MIPS_FPU_TYPE == MIPS_FPU_NONE ? "none"
+ : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
+ : MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
+ : "???"));
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_DEFAULT_SAVED_REGSIZE = %d\n",
+ MIPS_DEFAULT_SAVED_REGSIZE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_SAVED_REGSIZE = %d\n",
+ MIPS_SAVED_REGSIZE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: FP_REGISTER_DOUBLE = %d\n",
+ FP_REGISTER_DOUBLE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_REGS_HAVE_HOME_P = %d\n",
+ MIPS_REGS_HAVE_HOME_P);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_DEFAULT_STACK_ARGSIZE = %d\n",
+ MIPS_DEFAULT_STACK_ARGSIZE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_STACK_ARGSIZE = %d\n",
+ MIPS_STACK_ARGSIZE);
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: MIPS_REGSIZE = %d\n",
+ MIPS_REGSIZE);
}
-
void
_initialize_mips_tdep ()
{
static struct cmd_list_element *mipsfpulist = NULL;
struct cmd_list_element *c;
- if (GDB_MULTI_ARCH)
- register_gdbarch_init (bfd_arch_mips, mips_gdbarch_init);
+ gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep);
if (!tm_print_insn) /* Someone may have already set it */
tm_print_insn = gdb_print_insn_mips;