#include "gdbcmd.h"
#include "ppc-tdep.h"
#include "gdb_string.h"
+#include "observer.h"
#include <procinfo.h>
#include <sys/types.h>
static int arch64;
-/* Saved pointer to previous owner of
- deprecated_target_new_objfile_hook. */
-
-static void (*target_new_objfile_chain)(struct objfile *);
-
/* Forward declarations for pthdb callbacks. */
static int pdc_symbol_addrs (pthdb_user_t, pthdb_symbol_t *, int);
unpush_target (&aix_thread_ops);
}
-/* deprecated_target_new_objfile_hook callback.
+/* new_objfile observer callback.
If OBJFILE is non-null, check whether a threaded application is
being debugged, and if so, prepare for thread debugging.
pd_enable ();
else
pd_disable ();
-
- if (target_new_objfile_chain)
- target_new_objfile_chain (objfile);
}
/* Attach to process specified by ARGS. */
/* Check whether libpthdebug might be ready to be initialized. */
if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED &&
- status->value.sig == TARGET_SIGNAL_TRAP &&
- read_pc_pid (ptid) - DECR_PC_AFTER_BREAK == pd_brk_addr)
+ status->value.sig == TARGET_SIGNAL_TRAP
+ && read_pc_pid (ptid)
+ - gdbarch_decr_pc_after_break (current_gdbarch) == pd_brk_addr)
return pd_activate (0);
return pd_update (0);
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- return regno == PC_REGNUM
+ return regno == gdbarch_pc_regnum (current_gdbarch)
|| regno == tdep->ppc_ps_regnum
|| regno == tdep->ppc_cr_regnum
|| regno == tdep->ppc_lr_regnum
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- regcache_raw_supply (regcache, PC_REGNUM, (char *) &iar);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch),
+ (char *) &iar);
regcache_raw_supply (regcache, tdep->ppc_ps_regnum, (char *) &msr);
regcache_raw_supply (regcache, tdep->ppc_cr_regnum, (char *) &cr);
regcache_raw_supply (regcache, tdep->ppc_lr_regnum, (char *) &lr);
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- regcache_raw_supply (regcache, PC_REGNUM, (char *) &iar);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch),
+ (char *) &iar);
regcache_raw_supply (regcache, tdep->ppc_ps_regnum, (char *) &msr);
regcache_raw_supply (regcache, tdep->ppc_cr_regnum, (char *) &cr);
regcache_raw_supply (regcache, tdep->ppc_lr_regnum, (char *) &lr);
thread/process specified by inferior_ptid. */
static void
-aix_thread_fetch_registers (int regno)
+aix_thread_fetch_registers (struct regcache *regcache, int regno)
{
struct thread_info *thread;
pthdb_tid_t tid;
if (!PD_TID (inferior_ptid))
- base_target.to_fetch_registers (regno);
+ base_target.to_fetch_registers (regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)
- fetch_regs_user_thread (current_regcache, thread->private->pdtid);
+ fetch_regs_user_thread (regcache, thread->private->pdtid);
else
- fetch_regs_kernel_thread (current_regcache, regno, tid);
+ fetch_regs_kernel_thread (regcache, regno, tid);
}
}
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) == register_size (current_gdbarch, PC_REGNUM));
+ gdb_assert (sizeof (*iar) == register_size
+ (current_gdbarch,
+ gdbarch_pc_regnum (current_gdbarch)));
- if (regcache_valid_p (regcache, PC_REGNUM))
- regcache_raw_collect (regcache, PC_REGNUM, iar);
+ if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch)))
+ regcache_raw_collect (regcache, gdbarch_pc_regnum (current_gdbarch), iar);
if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
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) == register_size (current_gdbarch, PC_REGNUM));
+ gdb_assert (sizeof (*iar) == register_size (current_gdbarch,
+ gdbarch_pc_regnum
+ (current_gdbarch)));
- if (regcache_valid_p (regcache, PC_REGNUM))
- regcache_raw_collect (regcache, PC_REGNUM, iar);
+ if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch)))
+ regcache_raw_collect (regcache, gdbarch_pc_regnum (current_gdbarch), iar);
if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
&tmp_xer, &tmp_fpscr);
- if (regcache_valid_p (regcache, PC_REGNUM))
+ if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch)))
ctx.iar = tmp_iar;
if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
ctx.msr = tmp_msr;
thread/process specified by inferior_ptid. */
static void
-aix_thread_store_registers (int regno)
+aix_thread_store_registers (struct regcache *regcache, int regno)
{
struct thread_info *thread;
pthdb_tid_t tid;
if (!PD_TID (inferior_ptid))
- base_target.to_store_registers (regno);
+ base_target.to_store_registers (regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)
- store_regs_user_thread (current_regcache, thread->private->pdtid);
+ store_regs_user_thread (regcache, thread->private->pdtid);
else
- store_regs_kernel_thread (current_regcache, regno, tid);
+ store_regs_kernel_thread (regcache, regno, tid);
}
}
add_target (&aix_thread_ops);
/* Notice when object files get loaded and unloaded. */
- target_new_objfile_chain = deprecated_target_new_objfile_hook;
- deprecated_target_new_objfile_hook = new_objfile;
+ observer_attach_new_objfile (new_objfile);
add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread,
_("Set debugging of AIX thread module."),