X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=gdb%2Freggroups.c;h=b4790503024a58f5ad72d6ab46fd7321978630a6;hb=3e10640f3c843093ec9a8e95a9cd5c1b81dc156f;hp=7102c06ea53ce9615985f161f6245ca7c73553ed;hpb=a9762ec78a53fbe9209fe1654db42df0cd328d50;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 7102c06ea5..b479050302 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -1,6 +1,6 @@ /* Register groupings for GDB, the GNU debugger. - Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2012 Free Software Foundation, Inc. Contributed by Red Hat. @@ -20,6 +20,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "arch-utils.h" #include "reggroups.h" #include "gdbtypes.h" #include "gdb_assert.h" @@ -39,6 +40,7 @@ struct reggroup * reggroup_new (const char *name, enum reggroup_type type) { struct reggroup *group = XMALLOC (struct reggroup); + group->name = name; group->type = type; return group; @@ -79,6 +81,7 @@ reggroups_init (struct gdbarch *gdbarch) { struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct reggroups); + groups->last = &groups->first; return groups; } @@ -157,16 +160,14 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, int float_p; int raw_p; - if (gdbarch_register_name (current_gdbarch, regnum) == NULL - || *gdbarch_register_name (current_gdbarch, regnum) == '\0') + if (gdbarch_register_name (gdbarch, regnum) == NULL + || *gdbarch_register_name (gdbarch, regnum) == '\0') return 0; if (group == all_reggroup) return 1; vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT; - /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs - (gdbarch), as not all architectures are multi-arch. */ - raw_p = regnum < gdbarch_num_regs (current_gdbarch); + raw_p = regnum < gdbarch_num_regs (gdbarch); if (group == float_reggroup) return float_p; if (group == vector_reggroup) @@ -190,6 +191,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) /* Group name. */ { const char *name; + if (group == NULL) name = "Group"; else @@ -200,6 +202,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) /* Group type. */ { const char *type; + if (group == NULL) type = "Type"; else @@ -232,15 +235,20 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) static void maintenance_print_reggroups (char *args, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); + if (args == NULL) - reggroups_dump (current_gdbarch, gdb_stdout); + reggroups_dump (gdbarch, gdb_stdout); else { + struct cleanup *cleanups; struct ui_file *file = gdb_fopen (args, "w"); + if (file == NULL) perror_with_name (_("maintenance print reggroups")); - reggroups_dump (current_gdbarch, file); - ui_file_delete (file); + cleanups = make_cleanup_ui_file_delete (file); + reggroups_dump (gdbarch, file); + do_cleanups (cleanups); } }