mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
Eliminate find_target_beneath
Call target_ops::beneath() throughout instead. gdb/ChangeLog: 2018-06-07 Pedro Alves <palves@redhat.com> * target.h (find_target_beneath): Delete declaration. * target.c (find_target_beneath): Delete definition. * aix-thread.c: All callers of find_target_beneath adjusted to call target_ops::beneath instead. * bsd-uthread.c: Likewise. * linux-thread-db.c: Likewise. * ravenscar-thread.c: Likewise. * sol-thread.c: Likewise. * spu-multiarch.c: Likewise.
This commit is contained in:
parent
b6a8c27bb8
commit
d6ca69cddc
@ -1,3 +1,15 @@
|
||||
2018-06-07 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* target.h (find_target_beneath): Delete declaration.
|
||||
* target.c (find_target_beneath): Delete definition.
|
||||
* aix-thread.c: All callers of find_target_beneath adjusted to
|
||||
call target_ops::beneath instead.
|
||||
* bsd-uthread.c: Likewise.
|
||||
* linux-thread-db.c: Likewise.
|
||||
* ravenscar-thread.c: Likewise.
|
||||
* sol-thread.c: Likewise.
|
||||
* spu-multiarch.c: Likewise.
|
||||
|
||||
2018-06-07 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* target.h (target_ops) <beneath>: Now a method. All references
|
||||
|
@ -1023,7 +1023,7 @@ aix_thread_inferior_created (struct target_ops *ops, int from_tty)
|
||||
void
|
||||
aix_thread_target::detach (inferior *inf, int from_tty)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
target_ops *beneath = this->beneath ();
|
||||
|
||||
pd_disable ();
|
||||
beneath->detach (inf, from_tty);
|
||||
@ -1041,10 +1041,9 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
|
||||
if (!PD_TID (ptid))
|
||||
{
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
|
||||
beneath->resume (ptid, step, sig);
|
||||
beneath ()->resume (ptid, step, sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1078,15 +1077,13 @@ ptid_t
|
||||
aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
|
||||
int options)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
{
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
|
||||
pid_to_prc (&ptid);
|
||||
|
||||
inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
|
||||
ptid = beneath->wait (ptid, status, options);
|
||||
ptid = beneath ()->wait (ptid, status, options);
|
||||
}
|
||||
|
||||
if (ptid_get_pid (ptid) == -1)
|
||||
@ -1358,10 +1355,9 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
|
||||
{
|
||||
struct thread_info *thread;
|
||||
pthdb_tid_t tid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
if (!PD_TID (regcache->ptid ()))
|
||||
beneath->fetch_registers (regcache, regno);
|
||||
beneath ()->fetch_registers (regcache, regno);
|
||||
else
|
||||
{
|
||||
thread = find_thread_ptid (regcache->ptid ());
|
||||
@ -1699,10 +1695,9 @@ aix_thread_target::store_registers (struct regcache *regcache, int regno)
|
||||
{
|
||||
struct thread_info *thread;
|
||||
pthdb_tid_t tid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
if (!PD_TID (regcache->ptid ()))
|
||||
beneath->store_registers (regcache, regno);
|
||||
beneath ()->store_registers (regcache, regno);
|
||||
else
|
||||
{
|
||||
thread = find_thread_ptid (regcache->ptid ());
|
||||
@ -1726,11 +1721,10 @@ aix_thread_target::xfer_partial (enum target_object object,
|
||||
ULONGEST *xfered_len)
|
||||
{
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
|
||||
return beneath->xfer_partial (object, annex, readbuf,
|
||||
writebuf, offset, len, xfered_len);
|
||||
return beneath ()->xfer_partial (object, annex, readbuf,
|
||||
writebuf, offset, len, xfered_len);
|
||||
}
|
||||
|
||||
/* Clean up after the inferior exits. */
|
||||
@ -1738,7 +1732,7 @@ aix_thread_target::xfer_partial (enum target_object object,
|
||||
void
|
||||
aix_thread_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
target_ops *beneath = beneath ();
|
||||
|
||||
pd_deactivate ();
|
||||
beneath->mourn_inferior ();
|
||||
@ -1749,10 +1743,8 @@ aix_thread_target::mourn_inferior ()
|
||||
bool
|
||||
aix_thread_target::thread_alive (ptid_t ptid)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
if (!PD_TID (ptid))
|
||||
return beneath->thread_alive (ptid);
|
||||
return beneath ()->thread_alive (ptid);
|
||||
|
||||
/* We update the thread list every time the child stops, so all
|
||||
valid threads should be in the thread list. */
|
||||
@ -1766,10 +1758,9 @@ const char *
|
||||
aix_thread_target::pid_to_str (ptid_t ptid)
|
||||
{
|
||||
static char *ret = NULL;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
if (!PD_TID (ptid))
|
||||
return beneath->pid_to_str (ptid);
|
||||
return beneath ()->pid_to_str (ptid);
|
||||
|
||||
/* Free previous return value; a new one will be allocated by
|
||||
xstrprintf(). */
|
||||
|
@ -310,8 +310,7 @@ bsd_uthread_solib_unloaded (struct so_list *so)
|
||||
void
|
||||
bsd_uthread_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
beneath->mourn_inferior ();
|
||||
beneath ()->mourn_inferior ();
|
||||
bsd_uthread_deactivate ();
|
||||
}
|
||||
|
||||
@ -323,7 +322,6 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
|
||||
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
CORE_ADDR addr = ptid_get_tid (ptid);
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
CORE_ADDR active_addr;
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
|
||||
@ -332,7 +330,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
|
||||
inferior_ptid = ptid;
|
||||
|
||||
/* Always fetch the appropriate registers from the layer beneath. */
|
||||
beneath->fetch_registers (regcache, regnum);
|
||||
beneath ()->fetch_registers (regcache, regnum);
|
||||
|
||||
/* FIXME: That might have gotten us more than we asked for. Make
|
||||
sure we overwrite all relevant registers with values from the
|
||||
@ -354,7 +352,6 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
|
||||
struct gdbarch *gdbarch = regcache->arch ();
|
||||
struct bsd_uthread_ops *uthread_ops
|
||||
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
CORE_ADDR addr = ptid_get_tid (ptid);
|
||||
CORE_ADDR active_addr;
|
||||
@ -375,7 +372,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
|
||||
{
|
||||
/* Updating the thread that is currently running; pass the
|
||||
request to the layer beneath. */
|
||||
beneath->store_registers (regcache, regnum);
|
||||
beneath ()->store_registers (regcache, regnum);
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,10 +382,9 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
|
||||
{
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
CORE_ADDR addr;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
/* Pass the request to the layer beneath. */
|
||||
ptid = beneath->wait (ptid, status, options);
|
||||
ptid = beneath ()->wait (ptid, status, options);
|
||||
|
||||
/* If the process is no longer alive, there's no point in figuring
|
||||
out the thread ID. It will fail anyway. */
|
||||
@ -433,15 +429,13 @@ void
|
||||
bsd_uthread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
|
||||
{
|
||||
/* Pass the request to the layer beneath. */
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
beneath->resume (ptid, step, sig);
|
||||
beneath ()->resume (ptid, step, sig);
|
||||
}
|
||||
|
||||
bool
|
||||
bsd_uthread_target::thread_alive (ptid_t ptid)
|
||||
{
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
CORE_ADDR addr = ptid_get_tid (ptid);
|
||||
|
||||
if (addr != 0)
|
||||
@ -456,7 +450,7 @@ bsd_uthread_target::thread_alive (ptid_t ptid)
|
||||
return false;
|
||||
}
|
||||
|
||||
return beneath->thread_alive (ptid);
|
||||
return beneath ()->thread_alive (ptid);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1094,11 +1094,9 @@ record_thread (struct thread_db_info *info,
|
||||
void
|
||||
thread_db_target::detach (inferior *inf, int from_tty)
|
||||
{
|
||||
struct target_ops *target_beneath = find_target_beneath (this);
|
||||
|
||||
delete_thread_db_info (inf->pid);
|
||||
|
||||
target_beneath->detach (inf, from_tty);
|
||||
beneath ()->detach (inf, from_tty);
|
||||
|
||||
/* NOTE: From this point on, inferior_ptid is null_ptid. */
|
||||
|
||||
@ -1113,9 +1111,8 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
int options)
|
||||
{
|
||||
struct thread_db_info *info;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
ptid = beneath->wait (ptid, ourstatus, options);
|
||||
ptid = beneath ()->wait (ptid, ourstatus, options);
|
||||
|
||||
switch (ourstatus->kind)
|
||||
{
|
||||
@ -1152,11 +1149,9 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
void
|
||||
thread_db_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *target_beneath = find_target_beneath (this);
|
||||
|
||||
delete_thread_db_info (ptid_get_pid (inferior_ptid));
|
||||
|
||||
target_beneath->mourn_inferior ();
|
||||
beneath ()->mourn_inferior ();
|
||||
|
||||
/* Detach thread_db target ops. */
|
||||
if (!thread_db_list)
|
||||
@ -1376,7 +1371,6 @@ const char *
|
||||
thread_db_target::pid_to_str (ptid_t ptid)
|
||||
{
|
||||
struct thread_info *thread_info = find_thread_ptid (ptid);
|
||||
struct target_ops *beneath;
|
||||
|
||||
if (thread_info != NULL && thread_info->priv != NULL)
|
||||
{
|
||||
@ -1389,8 +1383,7 @@ thread_db_target::pid_to_str (ptid_t ptid)
|
||||
return buf;
|
||||
}
|
||||
|
||||
beneath = find_target_beneath (this);
|
||||
return beneath->pid_to_str (ptid);
|
||||
return beneath ()->pid_to_str (ptid);
|
||||
}
|
||||
|
||||
/* Return a string describing the state of the thread specified by
|
||||
@ -1451,7 +1444,6 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
|
||||
CORE_ADDR offset)
|
||||
{
|
||||
struct thread_info *thread_info;
|
||||
struct target_ops *beneath;
|
||||
|
||||
/* Find the matching thread. */
|
||||
thread_info = find_thread_ptid (ptid);
|
||||
@ -1523,8 +1515,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
|
||||
: (CORE_ADDR) (uintptr_t) address);
|
||||
}
|
||||
|
||||
beneath = find_target_beneath (this);
|
||||
return beneath->get_thread_local_address (ptid, lm, offset);
|
||||
return beneath ()->get_thread_local_address (ptid, lm, offset);
|
||||
}
|
||||
|
||||
/* Implement the to_get_ada_task_ptid target method for this target. */
|
||||
@ -1539,7 +1530,6 @@ thread_db_target::get_ada_task_ptid (long lwp, long thread)
|
||||
void
|
||||
thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
struct thread_db_info *info;
|
||||
|
||||
if (ptid_equal (ptid, minus_one_ptid))
|
||||
@ -1553,7 +1543,7 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
if (info)
|
||||
info->need_stale_parent_threads_check = 0;
|
||||
|
||||
beneath->resume (ptid, step, signo);
|
||||
beneath ()->resume (ptid, step, signo);
|
||||
}
|
||||
|
||||
/* std::sort helper function for info_auto_load_libthread_db, sort the
|
||||
|
@ -323,10 +323,8 @@ get_running_thread_id (int cpu)
|
||||
void
|
||||
ravenscar_thread_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
inferior_ptid = base_ptid;
|
||||
beneath->resume (base_ptid, step, siggnal);
|
||||
beneath ()->resume (base_ptid, step, siggnal);
|
||||
}
|
||||
|
||||
ptid_t
|
||||
@ -334,11 +332,10 @@ ravenscar_thread_target::wait (ptid_t ptid,
|
||||
struct target_waitstatus *status,
|
||||
int options)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t event_ptid;
|
||||
|
||||
inferior_ptid = base_ptid;
|
||||
event_ptid = beneath->wait (base_ptid, status, 0);
|
||||
event_ptid = beneath ()->wait (base_ptid, status, 0);
|
||||
/* Find any new threads that might have been created, and update
|
||||
inferior_ptid to the active thread.
|
||||
|
||||
@ -415,7 +412,6 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid)
|
||||
void
|
||||
ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
|
||||
if (ravenscar_runtime_initialized ()
|
||||
@ -429,14 +425,13 @@ ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
|
||||
arch_ops->to_fetch_registers (regcache, regnum);
|
||||
}
|
||||
else
|
||||
beneath->fetch_registers (regcache, regnum);
|
||||
beneath ()->fetch_registers (regcache, regnum);
|
||||
}
|
||||
|
||||
void
|
||||
ravenscar_thread_target::store_registers (struct regcache *regcache,
|
||||
int regnum)
|
||||
{
|
||||
target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
|
||||
if (ravenscar_runtime_initialized ()
|
||||
@ -447,16 +442,15 @@ ravenscar_thread_target::store_registers (struct regcache *regcache,
|
||||
struct ravenscar_arch_ops *arch_ops
|
||||
= gdbarch_ravenscar_ops (gdbarch);
|
||||
|
||||
beneath->store_registers (regcache, regnum);
|
||||
beneath ()->store_registers (regcache, regnum);
|
||||
}
|
||||
else
|
||||
beneath->store_registers (regcache, regnum);
|
||||
beneath ()->store_registers (regcache, regnum);
|
||||
}
|
||||
|
||||
void
|
||||
ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
|
||||
{
|
||||
target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
|
||||
if (ravenscar_runtime_initialized ()
|
||||
@ -467,10 +461,10 @@ ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
|
||||
struct ravenscar_arch_ops *arch_ops
|
||||
= gdbarch_ravenscar_ops (gdbarch);
|
||||
|
||||
beneath->prepare_to_store (regcache);
|
||||
beneath ()->prepare_to_store (regcache);
|
||||
}
|
||||
else
|
||||
beneath->prepare_to_store (regcache);
|
||||
beneath ()->prepare_to_store (regcache);
|
||||
}
|
||||
|
||||
/* Implement the to_stopped_by_sw_breakpoint target_ops "method". */
|
||||
@ -479,11 +473,10 @@ bool
|
||||
ravenscar_thread_target::stopped_by_sw_breakpoint ()
|
||||
{
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
bool result;
|
||||
|
||||
inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
|
||||
result = beneath->stopped_by_sw_breakpoint ();
|
||||
result = beneath ()->stopped_by_sw_breakpoint ();
|
||||
inferior_ptid = saved_ptid;
|
||||
return result;
|
||||
}
|
||||
@ -494,11 +487,10 @@ bool
|
||||
ravenscar_thread_target::stopped_by_hw_breakpoint ()
|
||||
{
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
bool result;
|
||||
|
||||
inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
|
||||
result = beneath->stopped_by_hw_breakpoint ();
|
||||
result = beneath ()->stopped_by_hw_breakpoint ();
|
||||
inferior_ptid = saved_ptid;
|
||||
return result;
|
||||
}
|
||||
@ -509,11 +501,10 @@ bool
|
||||
ravenscar_thread_target::stopped_by_watchpoint ()
|
||||
{
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
bool result;
|
||||
|
||||
inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
|
||||
result = beneath->stopped_by_watchpoint ();
|
||||
result = beneath ()->stopped_by_watchpoint ();
|
||||
inferior_ptid = saved_ptid;
|
||||
return result;
|
||||
}
|
||||
@ -524,11 +515,10 @@ bool
|
||||
ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
|
||||
{
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
bool result;
|
||||
|
||||
inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
|
||||
result = beneath->stopped_data_address (addr_p);
|
||||
result = beneath ()->stopped_data_address (addr_p);
|
||||
inferior_ptid = saved_ptid;
|
||||
return result;
|
||||
}
|
||||
@ -536,10 +526,8 @@ ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
|
||||
void
|
||||
ravenscar_thread_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
base_ptid = null_ptid;
|
||||
beneath->mourn_inferior ();
|
||||
beneath ()->mourn_inferior ();
|
||||
unpush_target (&ravenscar_ops);
|
||||
}
|
||||
|
||||
@ -549,11 +537,10 @@ int
|
||||
ravenscar_thread_target::core_of_thread (ptid_t ptid)
|
||||
{
|
||||
ptid_t saved_ptid = inferior_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
int result;
|
||||
|
||||
inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
|
||||
result = beneath->core_of_thread (inferior_ptid);
|
||||
result = beneath ()->core_of_thread (inferior_ptid);
|
||||
inferior_ptid = saved_ptid;
|
||||
return result;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ lwp_to_thread (ptid_t lwp)
|
||||
void
|
||||
sol_thread_target::detach (inferior *inf, int from_tty)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
target_ops *beneath = this->beneath ();
|
||||
|
||||
sol_thread_active = 0;
|
||||
inferior_ptid = pid_to_ptid (ptid_get_pid (main_ph.ptid));
|
||||
@ -400,8 +400,6 @@ sol_thread_target::detach (inferior *inf, int from_tty)
|
||||
void
|
||||
sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
|
||||
inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
|
||||
@ -420,7 +418,7 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
ptid_get_tid (save_ptid));
|
||||
}
|
||||
|
||||
beneath->resume (ptid, step, signo);
|
||||
beneath ()->resume (ptid, step, signo);
|
||||
}
|
||||
|
||||
/* Wait for any threads to stop. We may have to convert PTID from a
|
||||
@ -432,7 +430,6 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
{
|
||||
ptid_t rtnval;
|
||||
ptid_t save_ptid;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
save_ptid = inferior_ptid;
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
@ -453,7 +450,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
ptid_get_tid (save_ptid));
|
||||
}
|
||||
|
||||
rtnval = beneath->wait (ptid, ourstatus, options);
|
||||
rtnval = beneath ()->wait (ptid, ourstatus, options);
|
||||
|
||||
if (ourstatus->kind != TARGET_WAITKIND_EXITED)
|
||||
{
|
||||
@ -487,13 +484,12 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
|
||||
prfpregset_t fpregset;
|
||||
gdb_gregset_t *gregset_p = &gregset;
|
||||
gdb_fpregset_t *fpregset_p = &fpregset;
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
ptid_t ptid = regcache->ptid ();
|
||||
|
||||
if (!ptid_tid_p (ptid))
|
||||
{
|
||||
/* It's an LWP; pass the request on to the layer beneath. */
|
||||
beneath->fetch_registers (regcache, regnum);
|
||||
beneath ()->fetch_registers (regcache, regnum);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -544,10 +540,8 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
|
||||
|
||||
if (!ptid_tid_p (ptid))
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
/* It's an LWP; pass the request on to the layer beneath. */
|
||||
beneath->store_registers (regcache, regnum);
|
||||
beneath ()->store_registers (regcache, regnum);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -595,8 +589,6 @@ sol_thread_target::xfer_partial (enum target_object object,
|
||||
ULONGEST offset, ULONGEST len,
|
||||
ULONGEST *xfered_len)
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
|
||||
|
||||
if (ptid_tid_p (inferior_ptid) || !target_thread_alive (inferior_ptid))
|
||||
@ -609,8 +601,8 @@ sol_thread_target::xfer_partial (enum target_object object,
|
||||
inferior_ptid = procfs_first_available ();
|
||||
}
|
||||
|
||||
return beneath->xfer_partial (object, annex, readbuf,
|
||||
writebuf, offset, len, xfered_len);
|
||||
return beneath ()->xfer_partial (object, annex, readbuf,
|
||||
writebuf, offset, len, xfered_len);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -691,7 +683,7 @@ sol_thread_new_objfile (struct objfile *objfile)
|
||||
void
|
||||
sol_thread_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
target_ops *beneath = this->beneath ();
|
||||
|
||||
sol_thread_active = 0;
|
||||
|
||||
@ -721,10 +713,8 @@ sol_thread_target::thread_alive (ptid_t ptid)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
/* It's an LPW; pass the request on to the layer below. */
|
||||
return beneath->thread_alive (ptid);
|
||||
return beneath ()->thread_alive (ptid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1062,13 +1052,11 @@ sol_update_thread_list_callback (const td_thrhandle_t *th, void *ignored)
|
||||
void
|
||||
sol_thread_target::update_thread_list ()
|
||||
{
|
||||
struct target_ops *beneath = find_target_beneath (this);
|
||||
|
||||
/* Delete dead threads. */
|
||||
prune_threads ();
|
||||
|
||||
/* Find any new LWP's. */
|
||||
beneath->update_thread_list ();
|
||||
beneath ()->update_thread_list ();
|
||||
|
||||
/* Then find any new user-level threads. */
|
||||
p_td_ta_thr_iter (main_ta, sol_update_thread_list_callback, (void *) 0,
|
||||
|
@ -157,8 +157,7 @@ spu_multiarch_target::thread_architecture (ptid_t ptid)
|
||||
if (parse_spufs_run (ptid, &spufs_fd, &spufs_addr))
|
||||
return spu_gdbarch (spufs_fd);
|
||||
|
||||
target_ops *beneath = find_target_beneath (this);
|
||||
return beneath->thread_architecture (ptid);
|
||||
return beneath ()->thread_architecture (ptid);
|
||||
}
|
||||
|
||||
/* Override the to_region_ok_for_hw_watchpoint routine. */
|
||||
@ -166,13 +165,11 @@ spu_multiarch_target::thread_architecture (ptid_t ptid)
|
||||
int
|
||||
spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
|
||||
{
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
|
||||
/* We cannot watch SPU local store. */
|
||||
if (SPUADDR_SPU (addr) != -1)
|
||||
return 0;
|
||||
|
||||
return ops_beneath->region_ok_for_hw_watchpoint (addr, len);
|
||||
return beneath ()->region_ok_for_hw_watchpoint (addr, len);
|
||||
}
|
||||
|
||||
/* Override the to_fetch_registers routine. */
|
||||
@ -182,7 +179,6 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
|
||||
{
|
||||
struct gdbarch *gdbarch = regcache->arch ();
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
int spufs_fd;
|
||||
CORE_ADDR spufs_addr;
|
||||
|
||||
@ -194,7 +190,7 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
|
||||
/* This version applies only if we're currently in spu_run. */
|
||||
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
|
||||
{
|
||||
ops_beneath->fetch_registers (regcache, regno);
|
||||
beneath ()->fetch_registers (regcache, regno);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -215,7 +211,7 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
|
||||
{
|
||||
gdb_byte buf[4];
|
||||
|
||||
if (target_read (ops_beneath, TARGET_OBJECT_MEMORY, NULL,
|
||||
if (target_read (beneath (), TARGET_OBJECT_MEMORY, NULL,
|
||||
buf, spufs_addr, sizeof buf) == sizeof buf)
|
||||
regcache->raw_supply (SPU_PC_REGNUM, buf);
|
||||
}
|
||||
@ -228,7 +224,7 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
|
||||
int i;
|
||||
|
||||
xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd);
|
||||
if (target_read (ops_beneath, TARGET_OBJECT_SPU, annex,
|
||||
if (target_read (beneath (), TARGET_OBJECT_SPU, annex,
|
||||
buf, 0, sizeof buf) == sizeof buf)
|
||||
for (i = 0; i < SPU_NUM_GPRS; i++)
|
||||
regcache->raw_supply (i, buf + i*16);
|
||||
@ -241,7 +237,6 @@ void
|
||||
spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
|
||||
{
|
||||
struct gdbarch *gdbarch = regcache->arch ();
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
int spufs_fd;
|
||||
CORE_ADDR spufs_addr;
|
||||
|
||||
@ -253,7 +248,7 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
|
||||
/* This version applies only if we're currently in spu_run. */
|
||||
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
|
||||
{
|
||||
ops_beneath->store_registers (regcache, regno);
|
||||
beneath ()->store_registers (regcache, regno);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -267,7 +262,7 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
|
||||
gdb_byte buf[4];
|
||||
regcache->raw_collect (SPU_PC_REGNUM, buf);
|
||||
|
||||
target_write (ops_beneath, TARGET_OBJECT_MEMORY, NULL,
|
||||
target_write (beneath (), TARGET_OBJECT_MEMORY, NULL,
|
||||
buf, spufs_addr, sizeof buf);
|
||||
}
|
||||
|
||||
@ -282,7 +277,7 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
|
||||
regcache->raw_collect (i, buf + i*16);
|
||||
|
||||
xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd);
|
||||
target_write (ops_beneath, TARGET_OBJECT_SPU, annex,
|
||||
target_write (beneath (), TARGET_OBJECT_SPU, annex,
|
||||
buf, 0, sizeof buf);
|
||||
}
|
||||
}
|
||||
@ -295,7 +290,7 @@ spu_multiarch_target::xfer_partial (enum target_object object,
|
||||
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
|
||||
ULONGEST *xfered_len)
|
||||
{
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
struct target_ops *ops_beneath = this->beneath ();
|
||||
|
||||
/* Use the "mem" spufs file to access SPU local store. */
|
||||
if (object == TARGET_OBJECT_MEMORY)
|
||||
@ -345,15 +340,13 @@ spu_multiarch_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space
|
||||
const gdb_byte *pattern, ULONGEST pattern_len,
|
||||
CORE_ADDR *found_addrp)
|
||||
{
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
|
||||
/* For SPU local store, always fall back to the simple method. */
|
||||
if (SPUADDR_SPU (start_addr) >= 0)
|
||||
return simple_search_memory (this, start_addr, search_space_len,
|
||||
pattern, pattern_len, found_addrp);
|
||||
|
||||
return ops_beneath->search_memory (start_addr, search_space_len,
|
||||
pattern, pattern_len, found_addrp);
|
||||
return beneath ()->search_memory (start_addr, search_space_len,
|
||||
pattern, pattern_len, found_addrp);
|
||||
}
|
||||
|
||||
|
||||
@ -410,9 +403,7 @@ spu_multiarch_solib_unloaded (struct so_list *so)
|
||||
void
|
||||
spu_multiarch_target::mourn_inferior ()
|
||||
{
|
||||
struct target_ops *ops_beneath = find_target_beneath (this);
|
||||
|
||||
ops_beneath->mourn_inferior ();
|
||||
beneath ()->mourn_inferior ();
|
||||
spu_multiarch_deactivate ();
|
||||
}
|
||||
|
||||
|
10
gdb/target.c
10
gdb/target.c
@ -3211,16 +3211,6 @@ default_thread_architecture (struct target_ops *ops, ptid_t ptid)
|
||||
return inf->gdbarch;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the next target down the stack from the specified target.
|
||||
*/
|
||||
|
||||
struct target_ops *
|
||||
find_target_beneath (struct target_ops *t)
|
||||
{
|
||||
return t->beneath ();
|
||||
}
|
||||
|
||||
/* See target.h. */
|
||||
|
||||
struct target_ops *
|
||||
|
@ -2377,8 +2377,6 @@ extern void noprocess (void) ATTRIBUTE_NORETURN;
|
||||
|
||||
extern void target_require_runnable (void);
|
||||
|
||||
extern struct target_ops *find_target_beneath (struct target_ops *);
|
||||
|
||||
/* Find the target at STRATUM. If no target is at that stratum,
|
||||
return NULL. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user