Re: RFA: Change PowerPC E500 raw regcache layout

Jim Blandy
2004-08-04T17:48:19Z

Kevin Buettner <kevinb@redhat.com> writes:
> Okay, except for the uses of ``gdb_assert (0)''. Please use
> internal_error() for these instead.

Committed, but I had forgotten this caveat. I've committed the below
as a separate patch. As penance, I fixed the one I'd introduced in
rs6000_store_return_value, too.

2004-08-04 Jim Blandy <jimb@redhat.com>

* ppc-linux-nat.c (fetch_register): Replace 'gdb_assert (0)' with
a call to 'internal_error', with a more helpful error message.
* rs6000-tdep.c (e500_pseudo_register_read,
e500_pseudo_register_write, rs6000_store_return_value): Same.

Index: gdb/ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.51
diff -c -p -r1.51 ppc-linux-nat.c
*** gdb/ppc-linux-nat.c 4 Aug 2004 17:17:55 -0000 1.51
--- gdb/ppc-linux-nat.c 4 Aug 2004 17:32:37 -0000
*************** fetch_register (int tid, int regno)
*** 399,405 ****
regcache_raw_supply (current_regcache, regno, buf + padding);
}
else
! gdb_assert (0);
}

static void
--- 399,407 ----
regcache_raw_supply (current_regcache, regno, buf + padding);
}
else
! internal_error (__FILE__, __LINE__,
! "fetch_register: unexpected byte order: %d",
! gdbarch_byte_order (current_gdbarch));
}

static void
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.227
diff -c -p -r1.227 rs6000-tdep.c
*** gdb/rs6000-tdep.c 4 Aug 2004 17:17:55 -0000 1.227
--- gdb/rs6000-tdep.c 4 Aug 2004 17:32:39 -0000
*************** e500_pseudo_register_read (struct gdbarc
*** 1941,1948 ****
&& reg_nr < tdep->ppc_ev0_regnum + ppc_num_gprs)
e500_move_ev_register (regcache_raw_read, regcache, reg_nr, buffer);
else
! /* We should only be called on pseudo-registers. */
! gdb_assert (0);
}

static void
--- 1941,1950 ----
&& reg_nr < tdep->ppc_ev0_regnum + ppc_num_gprs)
e500_move_ev_register (regcache_raw_read, regcache, reg_nr, buffer);
else
! internal_error (__FILE__, __LINE__,
! "e500_pseudo_register_read: "
! "called on unexpected register '%s' (%d)",
! gdbarch_register_name (gdbarch, reg_nr), reg_nr);
}

static void
*************** e500_pseudo_register_write (struct gdbar
*** 1960,1967 ****
regcache_raw_write,
regcache, reg_nr, (void *) buffer);
else
! /* We should only be called on pseudo-registers. */
! gdb_assert (0);
}

/* The E500 needs a custom reggroup function: it has anonymous raw
--- 1962,1971 ----
regcache_raw_write,
regcache, reg_nr, (void *) buffer);
else
! internal_error (__FILE__, __LINE__,
! "e500_pseudo_register_read: "
! "called on unexpected register '%s' (%d)",
! gdbarch_register_name (gdbarch, reg_nr), reg_nr);
}

/* The E500 needs a custom reggroup function: it has anonymous raw
*************** rs6000_store_return_value (struct type *
*** 2095,2101 ****
&& TYPE_VECTOR (type))
regnum = tdep->ppc_vr0_regnum + 2;
else
! gdb_assert (0);
}
else
/* Everything else is returned in GPR3 and up. */
--- 2099,2107 ----
&& TYPE_VECTOR (type))
regnum = tdep->ppc_vr0_regnum + 2;
else
! internal_error (__FILE__, __LINE__,
! "rs6000_store_return_value: "
! "unexpected array return type");
}
else
/* Everything else is returned in GPR3 and up. */