Re: [RFA/RFC/IRIX] remove last uses of deprecated_registers in irix5-nat

Andrew Cagney
2004-11-14T01:10:25Z

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.