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

[patch] remove deprecated core support from QNX NTO


Really long ChangeLog for relatively simple fix. Created new supply_regset functions and changed my old ones to call them instead. Then register them with gdbarch and rip out all the deprecated stuff. Look okay?

cheers,

Kris

2004-12-21 Kris Warkentin <kewarken@qnx.com>

	* i386-nto-tdep.c (i386nto_supply_gregset_core): New function.
	(i386nto_supply_fpregset_core): Ditto.
	(i386nto_supply_gregset): Call core function above.
	(i386nto_supply_fpregset): Ditto.
	(i386nto_gregset): New structure for core file support.
	(i386nto_fpregset): Ditto.
	(i386nto_regset_from_core_section): New function.
	(i386nto_init_abi): Register core file support.
	* nto-tdep.c (fetch_core_registers): Remove function.
	(regset_core_fns): Remove structure.
	(_initialize_nto_tdep): Don't call deprecated_add_core_fns.

Index: i386-nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nto-tdep.c,v
retrieving revision 1.16
diff -c -r1.16 i386-nto-tdep.c
*** i386-nto-tdep.c	10 Dec 2004 13:38:23 -0000	1.16
--- i386-nto-tdep.c	21 Dec 2004 23:18:38 -0000
***************
*** 70,97 ****
  }
  
  static void
! i386nto_supply_gregset (char *gpregs)
  {
!   unsigned regno;
    int empty = 0;
  
!   for (regno = 0; regno < I386_NUM_GREGS; regno++)
      {
!       int offset = nto_reg_offset (regno);
!       if (offset == -1)
! 	regcache_raw_supply (current_regcache, regno, (char *) &empty);
!       else
! 	regcache_raw_supply (current_regcache, regno, gpregs + offset);
      }
  }
  
  static void
! i386nto_supply_fpregset (char *fpregs)
  {
!   if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR)
!     i387_supply_fxsave (current_regcache, -1, fpregs);
    else
!     i387_supply_fsave (current_regcache, -1, fpregs);
  }
  
  static void
--- 70,149 ----
  }
  
  static void
! i386nto_supply_gregset_core (const struct regset *regset,
! 			     struct regcache *regcache,
! 			     int regnum, const void *gregs, size_t len)
  {
!   const char *regs = gregs;
!   unsigned i;
    int empty = 0;
  
!   for (i = 0; i < I386_NUM_GREGS; i++)
      {
!       if (i == regnum || regnum == -1)
! 	{
! 	  int offset = nto_reg_offset (i);
! 	  if (offset == -1)
! 	    regcache_raw_supply (regcache, i, (char *) &empty);
! 	  else
! 	    regcache_raw_supply (regcache, i, regs + offset);
! 	}
      }
  }
  
  static void
! i386nto_supply_gregset (char *gpregs)
  {
!   i386nto_supply_gregset_core (NULL, current_regcache, -1, gpregs,
! 			       NUM_GPREGS * 4);
! }
! 
! static void
! i386nto_supply_fpregset_core (const struct regset *regset,
! 			      struct regcache *regcache,
! 			      int regnum, const void *fpregs, size_t len)
! {
!   if (len >= I387_SIZEOF_FXSAVE)
!     i387_supply_fxsave (current_regcache, regnum, fpregs);
    else
!     i387_supply_fsave (current_regcache, regnum, fpregs);
! }
! 
! static void
! i386nto_supply_fpregset (char *fpregs)
! {
!   int len = (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR) ?
!     I387_SIZEOF_FXSAVE : I387_SIZEOF_FSAVE;
! 
!   i386nto_supply_fpregset_core (NULL, current_regcache, -1, fpregs, len);
! }
! 
! /* nto i386 register sets.  */
! 
! static struct regset i386nto_gregset = {
!   NULL,
!   i386nto_supply_gregset_core
! };
! 
! static struct regset i386nto_fpregset = {
!   NULL,
!   i386nto_supply_fpregset_core
! };
! 
! /* Return the appropriate register set for the core section identified
!    by SECT_NAME and SECT_SIZE.  */
! 
! static const struct regset *
! i386nto_regset_from_core_section (struct gdbarch *gdbarch,
! 				  const char *sect_name, size_t sect_size)
! {
!   if (strcmp (sect_name, ".reg") == 0)
!     return &i386nto_gregset;
! 
!   if (strcmp (sect_name, ".reg2") == 0)
!     return &i386nto_fpregset;
! 
!   return NULL;
  }
  
  static void
***************
*** 276,281 ****
--- 328,337 ----
  {
    struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
  
+   /* Register core file support.  */
+   set_gdbarch_regset_from_core_section
+     (gdbarch, i386nto_regset_from_core_section);
+ 
    /* Deal with our strange signals.  */
    nto_initialize_signals ();
  
Index: nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.c,v
retrieving revision 1.10
diff -c -r1.10 nto-tdep.c
*** nto-tdep.c	10 Dec 2004 13:38:23 -0000	1.10
--- nto-tdep.c	21 Dec 2004 23:18:38 -0000
***************
*** 66,72 ****
  }
  
  void
! nto_set_target(struct nto_target_ops *targ)
  {
    nto_regset_id = targ->regset_id;
    nto_supply_gregset = targ->supply_gregset;
--- 66,72 ----
  }
  
  void
! nto_set_target (struct nto_target_ops *targ)
  {
    nto_regset_id = targ->regset_id;
    nto_supply_gregset = targ->supply_gregset;
***************
*** 345,385 ****
  nto_elf_osabi_sniffer (bfd *abfd)
  {
    if (nto_is_nto_target)
!       return nto_is_nto_target (abfd);
    return GDB_OSABI_UNKNOWN;
  }
  
- static void
- fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
- 		      int which, CORE_ADDR reg_addr)
- {
-   nto_regset_t regset;
- 
- /* See corelow.c:get_core_registers for values of WHICH.  */
-   if (which == 0)
-     {
-       memcpy ((char *) &regset, core_reg_sect,
- 	      min (core_reg_size, sizeof (regset)));
-       nto_supply_gregset ((char *) &regset);
-     }
-   else if (which == 2)
-     {
-       memcpy ((char *) &regset, core_reg_sect,
- 	      min (core_reg_size, sizeof (regset)));
-       nto_supply_fpregset ((char *) &regset);
-     }
- }
- 
- /* Register that we are able to handle ELF file formats using standard
-    procfs "regset" structures.  */
- static struct core_fns regset_core_fns = {
-   bfd_target_elf_flavour,	/* core_flavour */
-   default_check_format,		/* check_format */
-   default_core_sniffer,		/* core_sniffer */
-   fetch_core_registers,		/* core_read_registers */
-   NULL				/* next */
- };
- 
  void
  nto_initialize_signals (void)
  {
--- 345,354 ----
  nto_elf_osabi_sniffer (bfd *abfd)
  {
    if (nto_is_nto_target)
!     return nto_is_nto_target (abfd);
    return GDB_OSABI_UNKNOWN;
  }
  
  void
  nto_initialize_signals (void)
  {
***************
*** 414,419 ****
  displayed. Different information is displayed\n\
  for different positive values.", "\
  QNX NTO internal debugging is %s.", NULL, NULL, &setdebuglist, &showdebuglist);
-   /* Register core file support.  */
-   deprecated_add_core_fns (&regset_core_fns);
  }
--- 383,386 ----

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