This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: handle sparse register sets in Insight register window



The Insight register window doesn't properly display register sets
that have holes in the register numbering.  Jim Ingham's change of
1999-10-05 doesn't fix the whole problem.


In gdb/gdbtk/generic/ChangeLog-gdbtk:

2000-03-24  Jim Blandy  <jimb@redhat.com>

	Handle the fact that there are holes in the register numbering.
	(gdb_regnames): Return value is now a list of pairs of the form
	{REGNAME NUMBER}.
 	(get_register_name): Record both the register name and number.


In gdb/gdbtk/library/ChangeLog:

2000-03-24  Jim Blandy  <jimb@redhat.com>

	Handle the fact that there are holes in the register numbering.
	* actiondlg.tcl (ActionDlg::constructor): Handle new type of
 	gdb_regnames result.
	* regwin.itb (RegWin::init_reg_display_vars, RegWin::build_win):
 	Same.  Use the register numbers provided by gdb_regnames; don't
	just assume that the Nth element is register N.


Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.4
diff -c -r1.4 gdbtk-cmds.c
*** gdb/gdbtk/generic/gdbtk-cmds.c	2000/02/29 22:47:37	1.4
--- gdb/gdbtk/generic/gdbtk-cmds.c	2000/03/24 23:19:55
***************
*** 1834,1840 ****
  }
  
  /* This implements the TCL command `gdb_regnames', which returns a list of
!    all of the register names. */
  
  static int
  gdb_regnames (clientData, interp, objc, objv)
--- 1834,1840 ----
  }
  
  /* This implements the TCL command `gdb_regnames', which returns a list of
!    all of the register names, and their indices. */
  
  static int
  gdb_regnames (clientData, interp, objc, objv)
***************
*** 1854,1861 ****
       int regnum;
       void *argp;		/* Ignored */
  {
!   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
! 			    Tcl_NewStringObj (REGISTER_NAME (regnum), -1));
  }
  
  /* This implements the tcl command gdb_fetch_registers
--- 1854,1869 ----
       int regnum;
       void *argp;		/* Ignored */
  {
!   /* Build a tuple of the form "{REGNAME NUMBER}", and append it to
!      our result.  */
!   Tcl_Obj *array[2];
!   Tcl_Obj *pair;
! 
!   array[0] = Tcl_NewStringObj (REGISTER_NAME (regnum), -1);
!   array[1] = Tcl_NewIntObj (regnum);
!   pair = Tcl_NewListObj (2, array);
! 
!   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, pair);
  }
  
  /* This implements the tcl command gdb_fetch_registers
Index: gdb/gdbtk/library/actiondlg.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/actiondlg.tcl,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 actiondlg.tcl
*** gdb/gdbtk/library/actiondlg.tcl	2000/02/07 00:19:42	1.1.1.1
--- gdb/gdbtk/library/actiondlg.tcl	2000/03/24 23:20:00
***************
*** 30,36 ****
      set top [winfo toplevel [namespace tail $this]]
      wm withdraw $top
  
!     set Registers [gdb_regnames]
      if {$Line != ""} {
        set Locals  [gdb_get_locals "$File:$Line"]
        set Args    [gdb_get_args "$File:$Line"]
--- 30,40 ----
      set top [winfo toplevel [namespace tail $this]]
      wm withdraw $top
  
!     set Registers {}
!     set tmp [gdb_regnames]
!     foreach pair $tmp {
! 	lappend Registers [lindex $pair 0]
!     }
      if {$Line != ""} {
        set Locals  [gdb_get_locals "$File:$Line"]
        set Args    [gdb_get_args "$File:$Line"]
Index: gdb/gdbtk/library/regwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/regwin.itb,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 regwin.itb
*** gdb/gdbtk/library/regwin.itb	2000/02/07 00:19:42	1.1.1.1
--- gdb/gdbtk/library/regwin.itb	2000/03/24 23:20:01
***************
*** 77,83 ****
    
    set regMaxLen 0
    foreach r [gdb_regnames] {
!     set l [string length $r]
      if {$l > $regMaxLen} {
        set regMaxLen $l
      }
--- 77,83 ----
    
    set regMaxLen 0
    foreach r [gdb_regnames] {
!     set l [string length [lindex $r 0]]
      if {$l > $regMaxLen} {
        set regMaxLen $l
      }
***************
*** 187,206 ****
    set reg_display_list {}
    set regnames [gdb_regnames]
    set i 1
-   set rn 0
    foreach r $regnames {
!     set reg_display($rn,name) $r
!     set format [pref getd gdb/reg/$r-format]
      if {$format == ""} { set format x }
      set reg_display($rn,format) $format
!     if {$args != "" && [pref getd gdb/reg/$r] == "no"} {
        set reg_display($rn,line) 0
      } else {
        set reg_display($rn,line) $i
        lappend reg_display_list $rn
        incr i
      }
-     incr rn
    }
    set num_regs [expr {$i - 1}]
    set max_regs $rn
--- 187,206 ----
    set reg_display_list {}
    set regnames [gdb_regnames]
    set i 1
    foreach r $regnames {
!     set name [lindex $r 0]
!     set rn [lindex $r 1]
!     set reg_display($rn,name) $name
!     set format [pref getd gdb/reg/$name-format]
      if {$format == ""} { set format x }
      set reg_display($rn,format) $format
!     if {$args != "" && [pref getd gdb/reg/$name] == "no"} {
        set reg_display($rn,line) 0
      } else {
        set reg_display($rn,line) $i
        lappend reg_display_list $rn
        incr i
      }
    }
    set num_regs [expr {$i - 1}]
    set max_regs $rn

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]