This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
Re: RFA: Improvement to typed registers - editing
- To: insight at sourceware dot cygnus dot com
- Subject: Re: RFA: Improvement to typed registers - editing
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Fri, 09 Jun 2000 16:23:07 +0000
- Organization: Cygnus Solutions (a Red Hat company) - Toronto
- References: <393FD0B7.F359B9AB@cygnus.com>
I am committing this change.
Cheers,
Fernando
Fernando Nasser wrote:
>
> Expanding on the idea of giving types to registers, I gave registers
> like status registers a type so one can deal with specific bits by
> their proper names.
>
> However, when doing this I was preventing them to be edited in the register
> windows, like what happens to vector registers.
>
> This change fixes the problem. All status registers are created as a union
> which has the whole register with the register name as tag.
>
> With the patch below, such register work exactly as before in the register
> window PLUS have the bitfields defined which you can see and manipulate in
> the watch window.
>
> --
> Fernando Nasser
> Cygnus Solutions (a Red Hat company) E-Mail: fnasser@cygnus.com
> 2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
> Toronto, Ontario M4P 2C9 Fax: 416-482-6299
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/generic/ChangeLog,v
> retrieving revision 1.1
> diff -c -p -r1.1 ChangeLog
> *** ChangeLog 2000/04/17 20:20:59 1.1
> --- ChangeLog 2000/06/08 16:43:46
> ***************
> *** 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.
> +
> 2000-04-17 Jonathan Larmour <jlarmour@redhat.co.uk>
>
> * ChangeLog-gdbtk: Renamed to ChangeLog
> Index: gdbtk-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
> retrieving revision 1.7
> diff -c -p -r1.7 gdbtk-cmds.c
> *** gdbtk-cmds.c 2000/04/17 20:20:59 1.7
> --- gdbtk-cmds.c 2000/06/08 16:39:10
> *************** get_register (regnum, fp)
> *** 1944,1949 ****
> --- 1944,1950 ----
> 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;
> *************** get_register (regnum, fp)
> *** 1967,1976 ****
>
> /* Convert raw data to virtual format if necessary. */
>
> if (REGISTER_CONVERTIBLE (regnum))
> {
> ! REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
> ! raw_buffer, virtual_buffer);
> }
> else
> memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
> --- 1968,1978 ----
>
> /* Convert raw data to virtual format if necessary. */
>
> + reg_vtype = REGISTER_VIRTUAL_TYPE (regnum);
> if (REGISTER_CONVERTIBLE (regnum))
> {
> ! REGISTER_CONVERT_TO_VIRTUAL (regnum, reg_vtype,
> ! raw_buffer, virtual_buffer);
> }
> else
> memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
> *************** get_register (regnum, fp)
> *** 1992,1999 ****
> fputs_filtered (buf, gdb_stdout);
> }
> else
> ! val_print (REGISTER_VIRTUAL_TYPE (regnum), virtual_buffer, 0, 0,
> ! gdb_stdout, format, 1, 0, Val_pretty_default);
>
> }
>
> --- 1994,2008 ----
> fputs_filtered (buf, gdb_stdout);
> }
> else
> ! 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);
>
> }
--
Fernando Nasser
Cygnus Solutions (a Red Hat company) E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299