From b59ff9d5ff023638dba11477c822313178d14e4d Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 2 Nov 2002 15:13:34 +0000 Subject: 2002-11-02 Andrew Cagney * reggroups.h, reggroups.c: New files. * regcache.c: Include "reggroups.h". (enum regcache_dump_what): Add `regcache_dump_groups'. (regcache_dump): Contract size of the "Type" column. When specified, dump the register's groups. (maintenance_print_register_groups): New function. (_initialize_regcache): Add command `maint print register-groups'. * Makefile.in (COMMON_OBS): Add reggroups.o (SFILES): Add reggroups.c. (reggroups_h): Define. (regcache.o, gdbarch.o): Update dependencies. (reggroups.o): Specify dependencies. * gdbarch.sh (register_reggroup_p): Add pure multi-arch method. Add opaque declaration for `struct reggroup' in generated .h file. Include "reggroups.h" in generated .c file. gdbarch.h, gdbarch.c: Re-generate. --- gdb/gdbarch.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index b34e56506b1..0e438f377ed 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -64,6 +64,7 @@ #include "gdb_assert.h" #include "gdb_string.h" #include "gdb-events.h" +#include "reggroups.h" /* Static function declarations */ @@ -274,6 +275,7 @@ struct gdbarch gdbarch_address_class_type_flags_ftype *address_class_type_flags; gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name; gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags; + gdbarch_register_reggroup_p_ftype *register_reggroup_p; }; @@ -437,6 +439,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + default_register_reggroup_p, /* startup_gdbarch() */ }; @@ -568,6 +571,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special; current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; current_gdbarch->name_of_malloc = "malloc"; + current_gdbarch->register_reggroup_p = default_register_reggroup_p; /* gdbarch_alloc() */ return current_gdbarch; @@ -819,6 +823,9 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_class_type_flags, has predicate */ /* Skip verify of address_class_type_flags_to_name, has predicate */ /* Skip verify of address_class_name_to_type_flags, has predicate */ + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (gdbarch->register_reggroup_p == default_register_reggroup_p)) + fprintf_unfiltered (log, "\n\tregister_reggroup_p"); buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -851,6 +858,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", (long) current_gdbarch->in_function_epilogue_p); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: register_reggroup_p = 0x%08lx\n", + (long) current_gdbarch->register_reggroup_p); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: pseudo_register_read = 0x%08lx\n", @@ -5186,6 +5197,25 @@ set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags; } +int +gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->register_reggroup_p == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_register_reggroup_p invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n"); + return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup); +} + +void +set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, + gdbarch_register_reggroup_p_ftype register_reggroup_p) +{ + gdbarch->register_reggroup_p = register_reggroup_p; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ -- cgit v1.2.1