This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: remove meaningless code in ppc-bdm.c
- From: Jim Blandy <jimb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: 10 May 2004 17:45:17 -0500
- Subject: RFA: remove meaningless code in ppc-bdm.c
I was going through this trying to keep it up to date with the
register numbering changes I was making, but then I realized it was
complete jibberish. First, the register contents are binary data; you
can't strcat them. Second, you can't strcat them into a fixed-size
buffer that is already filled with non-zero bytes.
2004-05-10 Jim Blandy <jimb@redhat.com>
* ppc-bdm.c (bdm_ppc_fetch_registers): Replace utterly broken code
with a call to internal_error.
Index: gdb/ppc-bdm.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-bdm.c,v
retrieving revision 1.22
diff -c -p -r1.22 ppc-bdm.c
*** gdb/ppc-bdm.c 10 May 2004 18:58:44 -0000 1.22
--- gdb/ppc-bdm.c 10 May 2004 22:43:08 -0000
*************** bdm_ppc_fetch_registers (int regno)
*** 155,174 ****
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int i;
! unsigned char *regs, *beginregs, *endregs, *almostregs;
! unsigned char midregs[32];
! unsigned char mqreg[1];
int first_regno, last_regno;
int first_bdm_regno, last_bdm_regno;
! int reglen, beginreglen, endreglen;
!
! #if 1
! for (i = 0; i < ppc_num_fprs; i++)
! {
! midregs[i] = -1;
! }
! mqreg[0] = -1;
! #endif
if (regno == -1)
{
--- 155,164 ----
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int i;
! unsigned char *regs;
int first_regno, last_regno;
int first_bdm_regno, last_bdm_regno;
! int reglen;
if (regno == -1)
{
*************** bdm_ppc_fetch_registers (int regno)
*** 217,236 ****
}
}
else
! /* want all regs */
! {
! /* printf("Asking for registers %d to %d\n", first_regno, last_regno); */
! beginregs = ocd_read_bdm_registers (first_bdm_regno,
! tdep->ppc_fp0_regnum - 1,
! &beginreglen);
! endregs
! = (strcat (midregs,
! ocd_read_bdm_registers (tdep->ppc_fp0_regnum + ppc_num_fprs,
! last_bdm_regno - 1, &endreglen)));
! almostregs = (strcat (beginregs, endregs));
! regs = (strcat (almostregs, mqreg));
! reglen = beginreglen + 32 + endreglen + 1;
! }
#endif
#if 0
--- 207,215 ----
}
}
else
! internal_error (__FILE__, __LINE__,
! "ppc_bdm_fetch_registers: "
! "'all registers' case not implemented");
#endif
#if 0