diff options
-rw-r--r-- | gdb/gdbtk/generic/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-cmds.c | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/gdb/gdbtk/generic/ChangeLog b/gdb/gdbtk/generic/ChangeLog index 27379381537..ed7a659f40b 100644 --- a/gdb/gdbtk/generic/ChangeLog +++ b/gdb/gdbtk/generic/ChangeLog @@ -1,3 +1,8 @@ +2000-06-08 Fernando Nasser <fnasser@cygnus.com> + + * gdbtk-cmds.c (get_register): Allow editing of typed registers if + the type is a union with the first tag equal to the register name. + Thu Jun 8 17:59:01 2000 Andrew Cagney <cagney@b1.cygnus.com> (gdb_load_info): Use make_cleanup_bfd_close. diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c index ed78f08aed7..c804ff59496 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.c +++ b/gdb/gdbtk/generic/gdbtk-cmds.c @@ -1944,6 +1944,7 @@ get_register (regnum, fp) int regnum; void *fp; { + struct type *reg_vtype; char raw_buffer[MAX_REGISTER_RAW_SIZE]; char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; int format = (int) fp; @@ -1967,10 +1968,11 @@ get_register (regnum, fp) /* Convert raw data to virtual format if necessary. */ + reg_vtype = REGISTER_VIRTUAL_TYPE (regnum); if (REGISTER_CONVERTIBLE (regnum)) { - REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum), - raw_buffer, virtual_buffer); + REGISTER_CONVERT_TO_VIRTUAL (regnum, reg_vtype, + raw_buffer, virtual_buffer); } else memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum)); @@ -1992,8 +1994,15 @@ get_register (regnum, fp) fputs_filtered (buf, gdb_stdout); } else - val_print (REGISTER_VIRTUAL_TYPE (regnum), virtual_buffer, 0, 0, - gdb_stdout, format, 1, 0, Val_pretty_default); + if ((TYPE_CODE (reg_vtype) == TYPE_CODE_UNION) + && (strcmp (FIELD_NAME (TYPE_FIELD (reg_vtype, 0)), REGISTER_NAME (regnum)) == 0)) + { + val_print (FIELD_TYPE (TYPE_FIELD (reg_vtype, 0)), virtual_buffer, 0, 0, + gdb_stdout, format, 1, 0, Val_pretty_default); + } + else + val_print (REGISTER_VIRTUAL_TYPE (regnum), virtual_buffer, 0, 0, + gdb_stdout, format, 1, 0, Val_pretty_default); } |