public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Fernando Nasser <fnasser@cygnus.com>
To: insight@sourceware.cygnus.com
Subject: RFA: Improvement to typed registers - editing
Date: Thu, 08 Jun 2000 10:00:00 -0000	[thread overview]
Message-ID: <393FD0B7.F359B9AB@cygnus.com> (raw)

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);
  
  }

             reply	other threads:[~2000-06-08 10:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-08 10:00 Fernando Nasser [this message]
2000-06-09  9:24 ` Fernando Nasser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=393FD0B7.F359B9AB@cygnus.com \
    --to=fnasser@cygnus.com \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).