The following patches will add a ptid_t parameter to
target_fetch_registers and target_store_registers. In the bsd uthread
implementations, there's another indirection layer in the form of
bsd_uthread_ops. This patch adds the same ptid_t parameter to this
layer, so that the implementations of bsd_uthread_ops don't rely on the
current value of inferior_ptid.
From what I understand, the register values of the userspace threads
(uthreads) are stored in the memory of the "real" thread to which those
userspace threads are mapped. Therefore, the implementation of these
register fetching/storing functions consists of reading/writing memory.
Since the memory read/write functions still rely on the value of
inferior_ptid to know which thread to read/write memory from/to, it is
necessary to set and restore inferior_ptid in those functions (e.g.
amd64fbsd_supply_uthread). Eventually, when we add a ptid_t parameter
to the memory functions, this should go away as we'll simply pass down
the ptid parameter.
gdb/ChangeLog:
* amd64-fbsd-tdep.c (amd64fbsd_supply_uthread,
amd64fbsd_collect_uthread): Add ptid parameter, set and restore
inferior_ptid.
* amd64-obsd.tdep.c (amd64fbsd_collect_uthread,
amd64obsd_supply_uthread): Likewise.
* bsd-uthread.c (bsd_uthread_fetch_registers): Pass ptid value
to supply_uthread.
(bsd_uthread_store_registers): Pass ptid value to
collect_uthread.
* bsd-uthread.h (bsd_uthread_supply_register_ftype,
bsd_uthread_collect_register_ftype): Add ptid parameter.
* i386-fbsd-tdep.c (i386fbsd_supply_uthread,
i386fbsd_collect_uthread): Add ptid parameter, set and restore
inferior_ptid.
* i386-obsd-tdep.c (i386obsd_supply_uthread,
i386obsd_collect_uthread): Add ptid parameter, set and restore
inferior_ptid.
* sparc-obsd-tdep.c (sparc32obsd_supply_uthread,
sparc32obsd_collect_uthread): Add ptid parameter, set and restore
inferior_ptid.
* sparc-obsd-tdep.c (sparc64obsd_supply_uthread,
sparc64obsd_collect_uthread): Add ptid parameter, set and restore
inferior_ptid.