This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

[committed] Fix gcore crashes on s390


Hello,

since the switch of gcore to use regset_from_core_section, it
crashes on s390, because the regsets we're providing have a
NULL collect_regset function.  Fixed by the patch below.

Tested on s390-ibm-linux and s390x-ibm-linux.
Committed to mainline.

Bye,
Ulrich

ChangeLog:

	* s390-tdep.c (s390_collect_regset): New function.
	(s390_gregset, s390x_gregset, s390_fpregset): Add it.

Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.153
diff -c -p -r1.153 s390-tdep.c
*** gdb/s390-tdep.c	9 Apr 2006 01:21:15 -0000	1.153
--- gdb/s390-tdep.c	6 May 2006 00:55:38 -0000
*************** s390_supply_regset (const struct regset 
*** 444,462 ****
      }
  }
  
  static const struct regset s390_gregset = {
    s390_regmap_gregset, 
!   s390_supply_regset
  };
  
  static const struct regset s390x_gregset = {
    s390x_regmap_gregset, 
!   s390_supply_regset
  };
  
  static const struct regset s390_fpregset = {
    s390_regmap_fpregset, 
!   s390_supply_regset
  };
  
  /* Return the appropriate register set for the core section identified
--- 444,484 ----
      }
  }
  
+ /* Collect register REGNUM from the register cache REGCACHE and store
+    it in the buffer specified by REGS and LEN as described by the
+    general-purpose register set REGSET.  If REGNUM is -1, do this for
+    all registers in REGSET.  */
+ static void
+ s390_collect_regset (const struct regset *regset,
+ 		     const struct regcache *regcache,
+ 		     int regnum, void *regs, size_t len)
+ {
+   const int *offset = regset->descr;
+   int i;
+ 
+   for (i = 0; i < S390_NUM_REGS; i++)
+     {
+       if ((regnum == i || regnum == -1) && offset[i] != -1)
+ 	regcache_raw_collect (regcache, i, (char *)regs + offset[i]);
+     }
+ }
+ 
  static const struct regset s390_gregset = {
    s390_regmap_gregset, 
!   s390_supply_regset,
!   s390_collect_regset
  };
  
  static const struct regset s390x_gregset = {
    s390x_regmap_gregset, 
!   s390_supply_regset,
!   s390_collect_regset
  };
  
  static const struct regset s390_fpregset = {
    s390_regmap_fpregset, 
!   s390_supply_regset,
!   s390_collect_regset
  };
  
  /* Return the appropriate register set for the core section identified
-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


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