Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/RFC/IRIX] remove last uses of deprecated_registers in irix5-nat
@ 2004-11-13 23:27 Joel Brobecker
  2004-11-14  1:10 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Brobecker @ 2004-11-13 23:27 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

This patch deals with the last 2 instances of deprecated_registers
found in irix5-nat.c:

2004-11-13  Joel Brobecker  <brobecker@gnat.com>

        * irix5-nat.c (fetch_core_registers): Replace use of
        deprecated_registers by equivalent code.

Tested on mips-irix using corefile.exp. No regression.

Given that Andrew gave me a green light for the previous patch
(http://sources.redhat.com/ml/gdb-patches/2004-11/msg00292.html)
and followup patches, I will commit this change. But don't hesitate
to send tomatoes I me if I botched something.

-- 
Joel

[-- Attachment #2: core-irix.diff --]
[-- Type: text/plain, Size: 2253 bytes --]

--- irix5-nat.c.orig	2004-11-13 17:31:39.631455281 -0500
+++ irix5-nat.c	2004-11-13 18:17:08.214095369 -0500
@@ -221,52 +221,33 @@ static void
 fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
 		      int which, CORE_ADDR reg_addr)
 {
+  char *srcp = core_reg_sect;
+  int regno;
+
   if (core_reg_size == deprecated_register_bytes ())
     {
-      memcpy ((char *) deprecated_registers, core_reg_sect, core_reg_size);
+      for (regno = 0; regno < NUM_REGS; regno++)
+        {
+          regcache_raw_write (current_regcache, regno, srcp);
+          srcp += register_size (current_gdbarch, regno);
+        }
     }
   else if (mips_isa_regsize (current_gdbarch) == 4 &&
 	   core_reg_size == (2 * mips_isa_regsize (current_gdbarch)) * NUM_REGS)
     {
       /* This is a core file from a N32 executable, 64 bits are saved
          for all registers.  */
-      char *srcp = core_reg_sect;
-      char *dstp = deprecated_registers;
-      int regno;
-
       for (regno = 0; regno < NUM_REGS; regno++)
 	{
 	  if (regno >= FP0_REGNUM && regno < (FP0_REGNUM + 32))
 	    {
-	      /* FIXME, this is wrong, N32 has 64 bit FP regs, but GDB
-	         currently assumes that they are 32 bit.  */
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
-	      if (register_size (current_gdbarch, regno) == 4)
-		{
-		  /* copying 4 bytes from eight bytes?
-		     I don't see how this can be right...  */
-		  srcp += 4;
-		}
-	      else
-		{
-		  /* copy all 8 bytes (sizeof(double)) */
-		  *dstp++ = *srcp++;
-		  *dstp++ = *srcp++;
-		  *dstp++ = *srcp++;
-		  *dstp++ = *srcp++;
-		}
+              regcache_raw_write (current_regcache, regno, srcp);
 	    }
 	  else
 	    {
-	      srcp += 4;
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
-	      *dstp++ = *srcp++;
+              regcache_raw_write (current_regcache, regno, srcp + 4);
 	    }
+          srcp += 8;
 	}
     }
   else
@@ -274,8 +255,6 @@ fetch_core_registers (char *core_reg_sec
       warning ("wrong size gregset struct in core file");
       return;
     }
-
-  deprecated_registers_fetched ();
 }
 
 /* Register that we are able to handle irix5 core file formats.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA/RFC/IRIX] remove last uses of deprecated_registers in irix5-nat
  2004-11-13 23:27 [RFA/RFC/IRIX] remove last uses of deprecated_registers in irix5-nat Joel Brobecker
@ 2004-11-14  1:10 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2004-11-14  1:10 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Joel Brobecker wrote:
> This patch deals with the last 2 instances of deprecated_registers
> found in irix5-nat.c:
> 
> 2004-11-13  Joel Brobecker  <brobecker@gnat.com>
> 
>         * irix5-nat.c (fetch_core_registers): Replace use of
>         deprecated_registers by equivalent code.
> 
> Tested on mips-irix using corefile.exp. No regression.
> 
> Given that Andrew gave me a green light for the previous patch
> (http://sources.redhat.com/ml/gdb-patches/2004-11/msg00292.html)
> and followup patches, I will commit this change. But don't hesitate
> to send tomatoes I me if I botched something.

Go for it!

Andrew

> --- irix5-nat.c.orig	2004-11-13 17:31:39.631455281 -0500
> +++ irix5-nat.c	2004-11-13 18:17:08.214095369 -0500
> @@ -221,52 +221,33 @@ static void
>  fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
>  		      int which, CORE_ADDR reg_addr)
>  {
> +  char *srcp = core_reg_sect;
> +  int regno;
> +
>    if (core_reg_size == deprecated_register_bytes ())
>      {
> -      memcpy ((char *) deprecated_registers, core_reg_sect, core_reg_size);
> +      for (regno = 0; regno < NUM_REGS; regno++)
> +        {
> +          regcache_raw_write (current_regcache, regno, srcp);
> +          srcp += register_size (current_gdbarch, regno);
> +        }
>      }
>    else if (mips_isa_regsize (current_gdbarch) == 4 &&
>  	   core_reg_size == (2 * mips_isa_regsize (current_gdbarch)) * NUM_REGS)
>      {
>        /* This is a core file from a N32 executable, 64 bits are saved
>           for all registers.  */
> -      char *srcp = core_reg_sect;
> -      char *dstp = deprecated_registers;
> -      int regno;
> -
>        for (regno = 0; regno < NUM_REGS; regno++)
>  	{
>  	  if (regno >= FP0_REGNUM && regno < (FP0_REGNUM + 32))
>  	    {
> -	      /* FIXME, this is wrong, N32 has 64 bit FP regs, but GDB
> -	         currently assumes that they are 32 bit.  */
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> -	      if (register_size (current_gdbarch, regno) == 4)
> -		{
> -		  /* copying 4 bytes from eight bytes?
> -		     I don't see how this can be right...  */
> -		  srcp += 4;
> -		}
> -	      else
> -		{
> -		  /* copy all 8 bytes (sizeof(double)) */
> -		  *dstp++ = *srcp++;
> -		  *dstp++ = *srcp++;
> -		  *dstp++ = *srcp++;
> -		  *dstp++ = *srcp++;
> -		}
> +              regcache_raw_write (current_regcache, regno, srcp);
>  	    }
>  	  else
>  	    {
> -	      srcp += 4;
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> -	      *dstp++ = *srcp++;
> +              regcache_raw_write (current_regcache, regno, srcp + 4);
>  	    }
> +          srcp += 8;
>  	}
>      }
>    else
> @@ -274,8 +255,6 @@ fetch_core_registers (char *core_reg_sec
>        warning ("wrong size gregset struct in core file");
>        return;
>      }
> -
> -  deprecated_registers_fetched ();
>  }
>  
>  /* Register that we are able to handle irix5 core file formats.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-14  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-13 23:27 [RFA/RFC/IRIX] remove last uses of deprecated_registers in irix5-nat Joel Brobecker
2004-11-14  1:10 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox