#include "gdbcmd.h"
#include "language.h" /* for local_hex_string() */
#include "ppc-tdep.h"
+#include "gdb_string.h"
#include <procinfo.h>
#include <sys/types.h>
this is needed, I have implemented what I think it should do,
however this code is untested. */
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
return;
/* Check application word size. */
- arch64 = DEPRECATED_REGISTER_RAW_SIZE (0) == 8;
+ arch64 = register_size (current_gdbarch, 0) == 8;
/* Check whether the application is pthreaded. */
stub_name = NULL;
static void
supply_gprs64 (uint64_t *vals)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int regno;
- for (regno = 0; regno < 32; regno++)
- supply_register (regno, (char *) (vals + regno));
+ for (regno = 0; regno < ppc_num_gprs; regno++)
+ regcache_raw_supply (current_regcache, tdep->ppc_gp0_regnum + regno,
+ (char *) (vals + regno));
}
/* Record that 32-bit register REGNO contains VAL. */
static void
supply_reg32 (int regno, uint32_t val)
{
- supply_register (regno, (char *) &val);
+ regcache_raw_supply (current_regcache, regno, (char *) &val);
}
/* Record that the floating-point registers contain VALS. */
/* This function should never be called on architectures without
floating-point registers. */
- gdb_assert (ppc_floating_point_p (current_gdbarch));
+ gdb_assert (ppc_floating_point_unit_p (current_gdbarch));
- for (regno = 0; regno < 32; regno++)
- supply_register (regno + tdep->ppc_fp0_regnum, (char *) (vals + regno));
+ for (regno = 0; regno < ppc_num_fprs; regno++)
+ regcache_raw_supply (current_regcache, regno + tdep->ppc_fp0_regnum,
+ (char *) (vals + regno));
}
/* Predicate to test whether given register number is a "special" register. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- supply_register (PC_REGNUM, (char *) &iar);
- supply_register (tdep->ppc_ps_regnum, (char *) &msr);
- supply_register (tdep->ppc_cr_regnum, (char *) &cr);
- supply_register (tdep->ppc_lr_regnum, (char *) &lr);
- supply_register (tdep->ppc_ctr_regnum, (char *) &ctr);
- supply_register (tdep->ppc_xer_regnum, (char *) &xer);
+ regcache_raw_supply (current_regcache, PC_REGNUM, (char *) &iar);
+ regcache_raw_supply (current_regcache, tdep->ppc_ps_regnum, (char *) &msr);
+ regcache_raw_supply (current_regcache, tdep->ppc_cr_regnum, (char *) &cr);
+ regcache_raw_supply (current_regcache, tdep->ppc_lr_regnum, (char *) &lr);
+ regcache_raw_supply (current_regcache, tdep->ppc_ctr_regnum, (char *) &ctr);
+ regcache_raw_supply (current_regcache, tdep->ppc_xer_regnum, (char *) &xer);
if (tdep->ppc_fpscr_regnum >= 0)
- supply_register (tdep->ppc_fpscr_regnum, (char *) &fpscr);
+ regcache_raw_supply (current_regcache, tdep->ppc_fpscr_regnum,
+ (char *) &fpscr);
}
/* Record that the special registers contain the specified 32-bit
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- supply_register (PC_REGNUM, (char *) &iar);
- supply_register (tdep->ppc_ps_regnum, (char *) &msr);
- supply_register (tdep->ppc_cr_regnum, (char *) &cr);
- supply_register (tdep->ppc_lr_regnum, (char *) &lr);
- supply_register (tdep->ppc_ctr_regnum, (char *) &ctr);
- supply_register (tdep->ppc_xer_regnum, (char *) &xer);
+ regcache_raw_supply (current_regcache, PC_REGNUM, (char *) &iar);
+ regcache_raw_supply (current_regcache, tdep->ppc_ps_regnum, (char *) &msr);
+ regcache_raw_supply (current_regcache, tdep->ppc_cr_regnum, (char *) &cr);
+ regcache_raw_supply (current_regcache, tdep->ppc_lr_regnum, (char *) &lr);
+ regcache_raw_supply (current_regcache, tdep->ppc_ctr_regnum, (char *) &ctr);
+ regcache_raw_supply (current_regcache, tdep->ppc_xer_regnum, (char *) &xer);
if (tdep->ppc_fpscr_regnum >= 0)
- supply_register (tdep->ppc_fpscr_regnum, (char *) &fpscr);
+ regcache_raw_supply (current_regcache, tdep->ppc_fpscr_regnum,
+ (char *) &fpscr);
}
/* Fetch all registers from pthread PDTID, which doesn't have a kernel
static void
fetch_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
if (arch64)
supply_gprs64 (ctx.gpr);
else
- for (i = 0; i < 32; i++)
- supply_reg32 (i, ctx.gpr[i]);
+ for (i = 0; i < ppc_num_gprs; i++)
+ supply_reg32 (tdep->ppc_gp0_regnum + i, ctx.gpr[i]);
/* Floating-point registers. */
- if (ppc_floating_point_p (current_gdbarch))
+ if (ppc_floating_point_unit_p (current_gdbarch))
supply_fprs (ctx.fpr);
/* Special registers. */
fetch_regs_kernel_thread (int regno, pthdb_tid_t tid)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
int i;
{
if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
- for (i = 0; i < 32; i++)
- supply_reg32 (i, gprs32[i]);
+ for (i = 0; i < ppc_num_gprs; i++)
+ supply_reg32 (tdep->ppc_gp0_regnum + i, gprs32[i]);
}
}
sprs32.pt_fpscr);
if (tdep->ppc_mq_regnum >= 0)
- supply_register (tdep->ppc_mq_regnum, (char *) &sprs32.pt_mq);
+ regcache_raw_supply (current_regcache, tdep->ppc_mq_regnum,
+ (char *) &sprs32.pt_mq);
}
}
}
for (regno = 0; regno < ppc_num_gprs; regno++)
if (register_cached (tdep->ppc_gp0_regnum + regno))
- regcache_collect (tdep->ppc_gp0_regnum + regno, vals + regno);
+ regcache_raw_collect (current_regcache, tdep->ppc_gp0_regnum + regno,
+ vals + regno);
}
static void
for (regno = 0; regno < ppc_num_gprs; regno++)
if (register_cached (tdep->ppc_gp0_regnum + regno))
- regcache_collect (tdep->ppc_gp0_regnum + regno, vals + regno);
+ regcache_raw_collect (current_regcache, tdep->ppc_gp0_regnum + regno,
+ vals + regno);
}
/* Store the floating point registers into a double array. */
/* This function should never be called on architectures without
floating-point registers. */
- gdb_assert (ppc_floating_point_p (current_gdbarch));
+ gdb_assert (ppc_floating_point_unit_p (current_gdbarch));
for (regno = tdep->ppc_fp0_regnum;
regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
regno++)
if (register_cached (regno))
- regcache_collect (regno, vals + regno);
+ regcache_raw_collect (current_regcache, regno, vals + regno);
}
/* Store the special registers into the specified 64-bit and 32-bit
they're not, then either GDB has been built incorrectly, or
there's some other kind of internal error. To be really safe,
we should check all of the sizes. */
- gdb_assert (sizeof (*iar) == DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM));
+ gdb_assert (sizeof (*iar) == register_size (current_gdbarch, PC_REGNUM));
if (register_cached (PC_REGNUM))
- regcache_collect (PC_REGNUM, iar);
+ regcache_raw_collect (current_regcache, PC_REGNUM, iar);
if (register_cached (tdep->ppc_ps_regnum))
- regcache_collect (tdep->ppc_ps_regnum, msr);
+ regcache_raw_collect (current_regcache, tdep->ppc_ps_regnum, msr);
if (register_cached (tdep->ppc_cr_regnum))
- regcache_collect (tdep->ppc_cr_regnum, cr);
+ regcache_raw_collect (current_regcache, tdep->ppc_cr_regnum, cr);
if (register_cached (tdep->ppc_lr_regnum))
- regcache_collect (tdep->ppc_lr_regnum, lr);
+ regcache_raw_collect (current_regcache, tdep->ppc_lr_regnum, lr);
if (register_cached (tdep->ppc_ctr_regnum))
- regcache_collect (tdep->ppc_ctr_regnum, ctr);
+ regcache_raw_collect (current_regcache, tdep->ppc_ctr_regnum, ctr);
if (register_cached (tdep->ppc_xer_regnum))
- regcache_collect (tdep->ppc_xer_regnum, xer);
+ regcache_raw_collect (current_regcache, tdep->ppc_xer_regnum, xer);
if (tdep->ppc_fpscr_regnum >= 0
&& register_cached (tdep->ppc_fpscr_regnum))
- regcache_collect (tdep->ppc_fpscr_regnum, fpscr);
+ regcache_raw_collect (current_regcache, tdep->ppc_fpscr_regnum, fpscr);
}
static void
built incorrectly. In order to make use of many of the header
files in /usr/include/sys, GDB needs to be configured so that
sizeof (long) == 4). */
- gdb_assert (sizeof (*iar) == DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM));
+ gdb_assert (sizeof (*iar) == register_size (current_gdbarch, PC_REGNUM));
if (register_cached (PC_REGNUM))
- regcache_collect (PC_REGNUM, iar);
+ regcache_raw_collect (current_regcache, PC_REGNUM, iar);
if (register_cached (tdep->ppc_ps_regnum))
- regcache_collect (tdep->ppc_ps_regnum, msr);
+ regcache_raw_collect (current_regcache, tdep->ppc_ps_regnum, msr);
if (register_cached (tdep->ppc_cr_regnum))
- regcache_collect (tdep->ppc_cr_regnum, cr);
+ regcache_raw_collect (current_regcache, tdep->ppc_cr_regnum, cr);
if (register_cached (tdep->ppc_lr_regnum))
- regcache_collect (tdep->ppc_lr_regnum, lr);
+ regcache_raw_collect (current_regcache, tdep->ppc_lr_regnum, lr);
if (register_cached (tdep->ppc_ctr_regnum))
- regcache_collect (tdep->ppc_ctr_regnum, ctr);
+ regcache_raw_collect (current_regcache, tdep->ppc_ctr_regnum, ctr);
if (register_cached (tdep->ppc_xer_regnum))
- regcache_collect (tdep->ppc_xer_regnum, xer);
+ regcache_raw_collect (current_regcache, tdep->ppc_xer_regnum, xer);
if (tdep->ppc_fpscr_regnum >= 0
&& register_cached (tdep->ppc_fpscr_regnum))
- regcache_collect (tdep->ppc_fpscr_regnum, fpscr);
+ regcache_raw_collect (current_regcache, tdep->ppc_fpscr_regnum, fpscr);
}
/* Store all registers into pthread PDTID, which doesn't have a kernel
static void
store_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
uint32_t int32;
/* Collect general-purpose register values from the regcache. */
- for (i = 0; i < 32; i++)
- if (register_cached (i))
+ for (i = 0; i < ppc_num_gprs; i++)
+ if (register_cached (tdep->ppc_gp0_regnum + i))
{
if (arch64)
{
- regcache_collect (i, (void *) &int64);
+ regcache_raw_collect (current_regcache, tdep->ppc_gp0_regnum + i,
+ (void *) &int64);
ctx.gpr[i] = int64;
}
else
{
- regcache_collect (i, (void *) &int32);
+ regcache_raw_collect (current_regcache, tdep->ppc_gp0_regnum + i,
+ (void *) &int32);
ctx.gpr[i] = int32;
}
}
/* Collect floating-point register values from the regcache. */
- if (ppc_floating_point_p (current_gdbarch))
+ if (ppc_floating_point_unit_p (current_gdbarch))
fill_fprs (ctx.fpr);
/* Special registers (always kept in ctx as 64 bits). */
happens, GDB needs to be reconfigured so that longs are 32-bits.) */
unsigned long tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
tmp_fpscr;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
fill_sprs32 (&tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer,
&tmp_fpscr);
store_regs_kernel_thread (int regno, pthdb_tid_t tid)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog,
if (tdep->ppc_mq_regnum >= 0)
if (register_cached (tdep->ppc_mq_regnum))
- regcache_collect (tdep->ppc_mq_regnum, &sprs32.pt_mq);
+ regcache_raw_collect (current_regcache, tdep->ppc_mq_regnum,
+ &sprs32.pt_mq);
ptrace32 (PTT_WRITE_SPRS, tid, (int *) &sprs32, 0, NULL);
}
return base_target.to_pid_to_str (ptid);
/* Free previous return value; a new one will be allocated by
- xasprintf(). */
+ xstrprintf(). */
xfree (ret);
- xasprintf (&ret, "Thread %ld", ptid_get_tid (ptid));
+ ret = xstrprintf ("Thread %ld", ptid_get_tid (ptid));
return ret;
}
target_new_objfile_chain = deprecated_target_new_objfile_hook;
deprecated_target_new_objfile_hook = new_objfile;
- add_show_from_set (add_set_cmd ("aix-thread", no_class, var_zinteger,
- (char *) &debug_aix_thread,
- "Set debugging of AIX thread module.\n"
- "Enables printf debugging output.\n",
- &setdebuglist),
- &showdebuglist);
+ deprecated_add_show_from_set
+ (add_set_cmd ("aix-thread", no_class, var_zinteger,
+ (char *) &debug_aix_thread,
+ "Set debugging of AIX thread module.\n"
+ "Enables printf debugging output.\n",
+ &setdebuglist),
+ &showdebuglist);
}