Remove ptid_get_tid

This removes ptid_get_tid in favor of calling the ptid_t::tid method.

gdb/ChangeLog
2018-07-03  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_get_tid): Remove.
	* common/ptid.h (ptid_get_tid): Don't declare.
	* ada-tasks.c: Update.
	* aix-thread.c: Update.
	* bsd-uthread.c: Update.
	* darwin-nat.c: Update.
	* fbsd-nat.c: Update.
	* i386-darwin-nat.c: Update.
	* infrun.c: Update.
	* linux-tdep.c: Update.
	* nto-procfs.c: Update.
	* ppc-ravenscar-thread.c: Update.
	* python/py-infthread.c: Update.
	* ravenscar-thread.c: Update.
	* sol-thread.c: Update.
	* sparc-ravenscar-thread.c: Update.
	* windows-nat.c: Update.

gdb/gdbserver/ChangeLog
2018-07-03  Tom Tromey  <tom@tromey.com>

	* target.c: Update.
This commit is contained in:
Tom Tromey
2018-06-11 12:14:34 -06:00
parent e38504b392
commit cc6bcb548d
20 changed files with 91 additions and 79 deletions

View File

@ -1,3 +1,23 @@
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_tid): Remove.
* common/ptid.h (ptid_get_tid): Don't declare.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* bsd-uthread.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* i386-darwin-nat.c: Update.
* infrun.c: Update.
* linux-tdep.c: Update.
* nto-procfs.c: Update.
* ppc-ravenscar-thread.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* sol-thread.c: Update.
* sparc-ravenscar-thread.c: Update.
* windows-nat.c: Update.
2018-07-03 Tom Tromey <tom@tromey.com> 2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_lwp): Remove. * common/ptid.c (ptid_get_lwp): Remove.

View File

@ -1203,7 +1203,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
printf_filtered (_("<no name>\n")); printf_filtered (_("<no name>\n"));
/* Print the TID and LWP. */ /* Print the TID and LWP. */
printf_filtered (_("Thread: %#lx\n"), ptid_get_tid (task_info->ptid)); printf_filtered (_("Thread: %#lx\n"), task_info->ptid.tid ());
printf_filtered (_("LWP: %#lx\n"), task_info->ptid.lwp ()); printf_filtered (_("LWP: %#lx\n"), task_info->ptid.lwp ());
/* If set, print the base CPU. */ /* If set, print the base CPU. */

View File

@ -70,7 +70,7 @@ static int debug_aix_thread;
/* Return whether to treat PID as a debuggable thread id. */ /* Return whether to treat PID as a debuggable thread id. */
#define PD_TID(ptid) (pd_active && ptid_get_tid (ptid) != 0) #define PD_TID(ptid) (pd_active && ptid.tid () != 0)
/* pthdb_user_t value that we pass to pthdb functions. 0 causes /* pthdb_user_t value that we pass to pthdb functions. 0 causes
PTHDB_BAD_USER errors, so use 1. */ PTHDB_BAD_USER errors, so use 1. */
@ -677,9 +677,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
return -1; return -1;
else if (ptid1.pid () > ptid2.pid ()) else if (ptid1.pid () > ptid2.pid ())
return 1; return 1;
else if (ptid_get_tid (ptid1) < ptid_get_tid (ptid2)) else if (ptid1.tid () < ptid2.tid ())
return -1; return -1;
else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2)) else if (ptid1.tid () > ptid2.tid ())
return 1; return 1;
else if (ptid1.lwp () < ptid2.lwp ()) else if (ptid1.lwp () < ptid2.lwp ())
return -1; return -1;
@ -1766,7 +1766,7 @@ aix_thread_target::pid_to_str (ptid_t ptid)
xstrprintf(). */ xstrprintf(). */
xfree (ret); xfree (ret);
ret = xstrprintf (_("Thread %ld"), ptid_get_tid (ptid)); ret = xstrprintf (_("Thread %ld"), ptid.tid ());
return ret; return ret;
} }

View File

@ -321,7 +321,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
struct bsd_uthread_ops *uthread_ops struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data); = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
ptid_t ptid = regcache->ptid (); ptid_t ptid = regcache->ptid ();
CORE_ADDR addr = ptid_get_tid (ptid); CORE_ADDR addr = ptid.tid ();
CORE_ADDR active_addr; CORE_ADDR active_addr;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
@ -353,7 +353,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
struct bsd_uthread_ops *uthread_ops struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data); = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
ptid_t ptid = regcache->ptid (); ptid_t ptid = regcache->ptid ();
CORE_ADDR addr = ptid_get_tid (ptid); CORE_ADDR addr = ptid.tid ();
CORE_ADDR active_addr; CORE_ADDR active_addr;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
@ -414,8 +414,8 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* If INFERIOR_PTID doesn't have a tid member yet, and we now have a /* If INFERIOR_PTID doesn't have a tid member yet, and we now have a
ptid with tid set, then ptid is still the initial thread of ptid with tid set, then ptid is still the initial thread of
the process. Notify GDB core about it. */ the process. Notify GDB core about it. */
if (ptid_get_tid (inferior_ptid) == 0 if (inferior_ptid.tid () == 0
&& ptid_get_tid (ptid) != 0 && !in_thread_list (ptid)) && ptid.tid () != 0 && !in_thread_list (ptid))
thread_change_ptid (inferior_ptid, ptid); thread_change_ptid (inferior_ptid, ptid);
/* Don't let the core see a ptid without a corresponding thread. */ /* Don't let the core see a ptid without a corresponding thread. */
@ -437,7 +437,7 @@ bool
bsd_uthread_target::thread_alive (ptid_t ptid) bsd_uthread_target::thread_alive (ptid_t ptid)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr = ptid_get_tid (ptid); CORE_ADDR addr = ptid.tid ();
if (addr != 0) if (addr != 0)
{ {
@ -474,7 +474,7 @@ bsd_uthread_target::update_thread_list ()
/* If INFERIOR_PTID doesn't have a tid member yet, then ptid /* If INFERIOR_PTID doesn't have a tid member yet, then ptid
is still the initial thread of the process. Notify GDB is still the initial thread of the process. Notify GDB
core about it. */ core about it. */
if (ptid_get_tid (inferior_ptid) == 0) if (inferior_ptid.tid () == 0)
thread_change_ptid (inferior_ptid, ptid); thread_change_ptid (inferior_ptid, ptid);
else else
add_thread (ptid); add_thread (ptid);
@ -516,7 +516,7 @@ const char *
bsd_uthread_target::extra_thread_info (thread_info *info) bsd_uthread_target::extra_thread_info (thread_info *info)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr = ptid_get_tid (info->ptid); CORE_ADDR addr = info->ptid.tid ();
if (addr != 0) if (addr != 0)
{ {
@ -534,12 +534,12 @@ bsd_uthread_target::extra_thread_info (thread_info *info)
const char * const char *
bsd_uthread_target::pid_to_str (ptid_t ptid) bsd_uthread_target::pid_to_str (ptid_t ptid)
{ {
if (ptid_get_tid (ptid) != 0) if (ptid.tid () != 0)
{ {
static char buf[64]; static char buf[64];
xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx", xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
ptid.pid (), ptid_get_tid (ptid)); ptid.pid (), ptid.tid ());
return buf; return buf;
} }

View File

@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
/* See ptid.h. */ /* See ptid.h. */
long
ptid_get_tid (const ptid_t &ptid)
{
return ptid.tid ();
}
/* See ptid.h. */
int int
ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2) ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2)
{ {

View File

@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
/* The following functions are kept for backwards compatibility. The use of /* The following functions are kept for backwards compatibility. The use of
the ptid_t methods is preferred. */ the ptid_t methods is preferred. */
/* See ptid_t::tid. */
extern long ptid_get_tid (const ptid_t &ptid);
/* See ptid_t::operator== and ptid_t::operator!=. */ /* See ptid_t::operator== and ptid_t::operator!=. */
extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2); extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2);

View File

@ -930,7 +930,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
inferior_debug inferior_debug
(2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"), (2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"),
ptid.pid (), ptid_get_tid (ptid), step, signal); ptid.pid (), ptid.tid (), step, signal);
if (signal == GDB_SIGNAL_0) if (signal == GDB_SIGNAL_0)
nsignal = 0; nsignal = 0;
@ -957,7 +957,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
else else
{ {
struct inferior *inf = find_inferior_ptid (ptid); struct inferior *inf = find_inferior_ptid (ptid);
long tid = ptid_get_tid (ptid); long tid = ptid.tid ();
/* Stop the inferior (should be useless). */ /* Stop the inferior (should be useless). */
darwin_suspend_inferior (inf); darwin_suspend_inferior (inf);
@ -1172,7 +1172,7 @@ cancel_breakpoint (ptid_t ptid)
if (breakpoint_inserted_here_p (regcache->aspace (), pc)) if (breakpoint_inserted_here_p (regcache->aspace (), pc))
{ {
inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n", inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n",
(unsigned long) ptid_get_tid (ptid)); (unsigned long) ptid.tid ());
/* Back up the PC if necessary. */ /* Back up the PC if necessary. */
if (gdbarch_decr_pc_after_break (gdbarch)) if (gdbarch_decr_pc_after_break (gdbarch))
@ -1199,7 +1199,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
inferior_debug inferior_debug
(2, _("darwin_wait: waiting for a message pid=%d thread=%lx\n"), (2, _("darwin_wait: waiting for a message pid=%d thread=%lx\n"),
ptid.pid (), ptid_get_tid (ptid)); ptid.pid (), ptid.tid ());
/* Handle fake stop events at first. */ /* Handle fake stop events at first. */
if (darwin_inf_fake_stop != NULL) if (darwin_inf_fake_stop != NULL)
@ -1906,7 +1906,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
darwin_inferior *priv = get_darwin_inferior (inf); darwin_inferior *priv = get_darwin_inferior (inf);
darwin_check_osabi (priv, ptid_get_tid (inferior_ptid)); darwin_check_osabi (priv, inferior_ptid.tid ());
darwin_setup_fake_stop_event (inf); darwin_setup_fake_stop_event (inf);
@ -1962,7 +1962,7 @@ const char *
darwin_nat_target::pid_to_str (ptid_t ptid) darwin_nat_target::pid_to_str (ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
long tid = ptid_get_tid (ptid); long tid = ptid.tid ();
if (tid != 0) if (tid != 0)
{ {

View File

@ -1101,7 +1101,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n", "FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
ptid.pid (), ptid.lwp (), ptid.pid (), ptid.lwp (),
ptid_get_tid (ptid)); ptid.tid ());
if (ptid_lwp_p (ptid)) if (ptid_lwp_p (ptid))
{ {
/* If ptid is a specific LWP, suspend all other LWPs in the process. */ /* If ptid is a specific LWP, suspend all other LWPs in the process. */

View File

@ -1,3 +1,7 @@
2018-07-03 Tom Tromey <tom@tromey.com>
* target.c: Update.
2018-07-03 Tom Tromey <tom@tromey.com> 2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update. * linux-low.c: Update.

View File

@ -318,9 +318,9 @@ target_pid_to_str (ptid_t ptid)
xsnprintf (buf, sizeof (buf), "<all threads>"); xsnprintf (buf, sizeof (buf), "<all threads>");
else if (ptid_equal (ptid, null_ptid)) else if (ptid_equal (ptid, null_ptid))
xsnprintf (buf, sizeof (buf), "<null thread>"); xsnprintf (buf, sizeof (buf), "<null thread>");
else if (ptid_get_tid (ptid) != 0) else if (ptid.tid () != 0)
xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx", xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
ptid.pid (), ptid_get_tid (ptid)); ptid.pid (), ptid.tid ());
else if (ptid.lwp () != 0) else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %d.%ld", xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
ptid.pid (), ptid.lwp ()); ptid.pid (), ptid.lwp ());

View File

@ -59,7 +59,7 @@ static struct i386_darwin_nat_target darwin_target;
void void
i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno) i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
{ {
thread_t current_thread = ptid_get_tid (regcache->ptid ()); thread_t current_thread = regcache->ptid ().tid ();
int fetched = 0; int fetched = 0;
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
@ -175,7 +175,7 @@ void
i386_darwin_nat_target::store_registers (struct regcache *regcache, i386_darwin_nat_target::store_registers (struct regcache *regcache,
int regno) int regno)
{ {
thread_t current_thread = ptid_get_tid (regcache->ptid ()); thread_t current_thread = regcache->ptid ().tid ();
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
#ifdef BFD64 #ifdef BFD64
@ -288,7 +288,7 @@ i386_darwin_dr_set (int regnum, CORE_ADDR value)
gdb_assert (regnum >= 0 && regnum <= DR_CONTROL); gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
current_thread = ptid_get_tid (inferior_ptid); current_thread = inferior_ptid.tid ();
dr_regs.dsh.flavor = x86_DEBUG_STATE; dr_regs.dsh.flavor = x86_DEBUG_STATE;
dr_regs.dsh.count = x86_DEBUG_STATE_COUNT; dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;
@ -377,7 +377,7 @@ i386_darwin_dr_get (int regnum)
gdb_assert (regnum >= 0 && regnum <= DR_CONTROL); gdb_assert (regnum >= 0 && regnum <= DR_CONTROL);
current_thread = ptid_get_tid (inferior_ptid); current_thread = inferior_ptid.tid ();
dr_regs.dsh.flavor = x86_DEBUG_STATE; dr_regs.dsh.flavor = x86_DEBUG_STATE;
dr_regs.dsh.count = x86_DEBUG_STATE_COUNT; dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;

View File

@ -3424,14 +3424,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
stb.printf ("infrun: target_wait (%d.%ld.%ld", stb.printf ("infrun: target_wait (%d.%ld.%ld",
waiton_ptid.pid (), waiton_ptid.pid (),
waiton_ptid.lwp (), waiton_ptid.lwp (),
ptid_get_tid (waiton_ptid)); waiton_ptid.tid ());
if (waiton_ptid.pid () != -1) if (waiton_ptid.pid () != -1)
stb.printf (" [%s]", target_pid_to_str (waiton_ptid)); stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
stb.printf (", status) =\n"); stb.printf (", status) =\n");
stb.printf ("infrun: %d.%ld.%ld [%s],\n", stb.printf ("infrun: %d.%ld.%ld [%s],\n",
result_ptid.pid (), result_ptid.pid (),
result_ptid.lwp (), result_ptid.lwp (),
ptid_get_tid (result_ptid), result_ptid.tid (),
target_pid_to_str (result_ptid)); target_pid_to_str (result_ptid));
stb.printf ("infrun: %s\n", status_string.c_str ()); stb.printf ("infrun: %s\n", status_string.c_str ());
@ -4378,7 +4378,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
statstr.c_str (), statstr.c_str (),
tp->ptid.pid (), tp->ptid.pid (),
tp->ptid.lwp (), tp->ptid.lwp (),
ptid_get_tid (tp->ptid)); tp->ptid.tid ());
} }
/* Record for later. */ /* Record for later. */
@ -4615,7 +4615,7 @@ stop_all_threads (void)
statstr.c_str (), statstr.c_str (),
t->ptid.pid (), t->ptid.pid (),
t->ptid.lwp (), t->ptid.lwp (),
ptid_get_tid (t->ptid)); t->ptid.tid ());
} }
/* Record for later. */ /* Record for later. */

View File

@ -1634,7 +1634,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
/* For remote targets the LWP may not be available, so use the TID. */ /* For remote targets the LWP may not be available, so use the TID. */
data.lwp = ptid.lwp (); data.lwp = ptid.lwp ();
if (!data.lwp) if (!data.lwp)
data.lwp = ptid_get_tid (ptid); data.lwp = ptid.tid ();
gdbarch_iterate_over_regset_sections (gdbarch, gdbarch_iterate_over_regset_sections (gdbarch,
linux_collect_regset_section_cb, linux_collect_regset_section_cb,

View File

@ -296,7 +296,7 @@ procfs_set_thread (ptid_t ptid)
{ {
pid_t tid; pid_t tid;
tid = ptid_get_tid (ptid); tid = ptid.tid ();
devctl (ctl_fd, DCMD_PROC_CURTHREAD, &tid, sizeof (tid), 0); devctl (ctl_fd, DCMD_PROC_CURTHREAD, &tid, sizeof (tid), 0);
} }
@ -310,7 +310,7 @@ nto_procfs_target::thread_alive (ptid_t ptid)
procfs_status status; procfs_status status;
int err; int err;
tid = ptid_get_tid (ptid); tid = ptid.tid ();
pid = ptid.pid (); pid = ptid.pid ();
if (kill (pid, 0) == -1) if (kill (pid, 0) == -1)
@ -1469,7 +1469,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid)
struct tidinfo *tip; struct tidinfo *tip;
pid = ptid.pid (); pid = ptid.pid ();
tid = ptid_get_tid (ptid); tid = ptid.tid ();
n = snprintf (buf, 1023, "process %d", pid); n = snprintf (buf, 1023, "process %d", pid);

View File

@ -154,7 +154,7 @@ ppc_ravenscar_generic_fetch_registers
CORE_ADDR thread_descriptor_address; CORE_ADDR thread_descriptor_address;
/* The tid is the thread_id field, which is a pointer to the thread. */ /* The tid is the thread_id field, which is a pointer to the thread. */
thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid); thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid ();
/* Read registers. */ /* Read registers. */
for (current_regnum = 0; current_regnum < num_regs; current_regnum++) for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
@ -193,7 +193,7 @@ ppc_ravenscar_generic_store_registers
if (register_in_thread_descriptor_p (reg_info, regnum)) if (register_in_thread_descriptor_p (reg_info, regnum))
register_address register_address
= ptid_get_tid (inferior_ptid) + reg_info->context_offsets [regnum]; = inferior_ptid.tid () + reg_info->context_offsets [regnum];
else else
return; return;

View File

@ -268,7 +268,7 @@ gdbpy_create_ptid_object (ptid_t ptid)
pid = ptid.pid (); pid = ptid.pid ();
lwp = ptid.lwp (); lwp = ptid.lwp ();
tid = ptid_get_tid (ptid); tid = ptid.tid ();
PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid)); PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (lwp)); PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (lwp));

View File

@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid)
2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo' 2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
query, which the remote protocol layer then treats as a thread query, which the remote protocol layer then treats as a thread
whose TID is 0. This is obviously not a ravenscar task. */ whose TID is 0. This is obviously not a ravenscar task. */
return ptid.lwp () == 0 && ptid_get_tid (ptid) != 0; return ptid.lwp () == 0 && ptid.tid () != 0;
} }
/* Given PTID, which can be either a ravenscar task or a CPU thread, /* Given PTID, which can be either a ravenscar task or a CPU thread,
@ -405,7 +405,7 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid)
{ {
static char buf[30]; static char buf[30];
snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid_get_tid (ptid)); snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid.tid ());
return buf; return buf;
} }

View File

@ -305,7 +305,7 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
/* It's a thread. Convert to LWP. */ /* It's a thread. Convert to LWP. */
val = p_td_ta_map_id2thr (main_ta, ptid_get_tid (thread_id), &th); val = p_td_ta_map_id2thr (main_ta, thread_id.tid (), &th);
if (val == TD_NOTHR) if (val == TD_NOTHR)
return ptid_t (-1); /* Thread must have terminated. */ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK) else if (val != TD_OK)
@ -415,7 +415,7 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
error (_("This version of Solaris can't start inactive threads.")); error (_("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1) if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"), warning (_("Specified thread %ld seems to have terminated"),
ptid_get_tid (save_ptid)); save_ptid.tid ());
} }
beneath ()->resume (ptid, step, signo); beneath ()->resume (ptid, step, signo);
@ -447,7 +447,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
error (_("This version of Solaris can't start inactive threads.")); error (_("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1) if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"), warning (_("Specified thread %ld seems to have terminated"),
ptid_get_tid (save_ptid)); save_ptid.tid ());
} }
rtnval = beneath ()->wait (ptid, ourstatus, options); rtnval = beneath ()->wait (ptid, ourstatus, options);
@ -494,7 +494,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
} }
/* Solaris thread: convert PTID into a td_thrhandle_t. */ /* Solaris thread: convert PTID into a td_thrhandle_t. */
thread = ptid_get_tid (ptid); thread = ptid.tid ();
if (thread == 0) if (thread == 0)
error (_("sol_thread_fetch_registers: thread == 0")); error (_("sol_thread_fetch_registers: thread == 0"));
@ -546,7 +546,7 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
} }
/* Solaris thread: convert PTID into a td_thrhandle_t. */ /* Solaris thread: convert PTID into a td_thrhandle_t. */
thread = ptid_get_tid (ptid); thread = ptid.tid ();
val = p_td_ta_map_id2thr (main_ta, thread, &thandle); val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
if (val != TD_OK) if (val != TD_OK)
@ -704,7 +704,7 @@ sol_thread_target::thread_alive (ptid_t ptid)
td_thrhandle_t th; td_thrhandle_t th;
int pid; int pid;
pid = ptid_get_tid (ptid); pid = ptid.tid ();
if ((val = p_td_ta_map_id2thr (main_ta, pid, &th)) != TD_OK) if ((val = p_td_ta_map_id2thr (main_ta, pid, &th)) != TD_OK)
return false; /* Thread not found. */ return false; /* Thread not found. */
if ((val = p_td_thr_validate (&th)) != TD_OK) if ((val = p_td_thr_validate (&th)) != TD_OK)
@ -1011,13 +1011,13 @@ sol_thread_target::pid_to_str (ptid_t ptid)
if (lwp.pid () == -1) if (lwp.pid () == -1)
xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)", xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
ptid_get_tid (ptid)); ptid.tid ());
else if (lwp.pid () != -2) else if (lwp.pid () != -2)
xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)", xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
ptid_get_tid (ptid), lwp.lwp ()); ptid.tid (), lwp.lwp ());
else else
xsnprintf (buf, sizeof (buf), "Thread %ld ", xsnprintf (buf, sizeof (buf), "Thread %ld ",
ptid_get_tid (ptid)); ptid.tid ());
} }
else if (ptid.lwp () != 0) else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid.lwp ()); xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid.lwp ());
@ -1157,7 +1157,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
{ {
long *tid = (long *) data; long *tid = (long *) data;
if (ptid_get_tid (thread->ptid) == *tid) if (thread->ptid.tid () == *tid)
return 1; return 1;
return 0; return 0;

View File

@ -112,7 +112,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
ULONGEST stack_address; ULONGEST stack_address;
/* The tid is the thread_id field, which is a pointer to the thread. */ /* The tid is the thread_id field, which is a pointer to the thread. */
thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid); thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid ();
/* Read the saved SP in the context buffer. */ /* Read the saved SP in the context buffer. */
current_address = thread_descriptor_address current_address = thread_descriptor_address
@ -162,7 +162,7 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
if (register_in_thread_descriptor_p (regnum)) if (register_in_thread_descriptor_p (regnum))
register_address = register_address =
ptid_get_tid (inferior_ptid) + sparc_register_offsets [regnum]; inferior_ptid.tid () + sparc_register_offsets [regnum];
else if (register_on_stack_p (regnum)) else if (register_on_stack_p (regnum))
{ {
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,

View File

@ -427,9 +427,9 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
windows_thread_info *th; windows_thread_info *th;
DWORD id; DWORD id;
gdb_assert (ptid_get_tid (ptid) != 0); gdb_assert (ptid.tid () != 0);
id = ptid_get_tid (ptid); id = ptid.tid ();
if ((th = thread_rec (id, FALSE))) if ((th = thread_rec (id, FALSE)))
return th; return th;
@ -484,9 +484,9 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
windows_thread_info *th; windows_thread_info *th;
DWORD id; DWORD id;
gdb_assert (ptid_get_tid (ptid) != 0); gdb_assert (ptid.tid () != 0);
id = ptid_get_tid (ptid); id = ptid.tid ();
if (info_verbose) if (info_verbose)
printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid)); printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid));
@ -555,7 +555,7 @@ windows_fetch_one_register (struct regcache *regcache,
void void
windows_nat_target::fetch_registers (struct regcache *regcache, int r) windows_nat_target::fetch_registers (struct regcache *regcache, int r)
{ {
DWORD pid = ptid_get_tid (regcache->ptid ()); DWORD pid = regcache->ptid ().tid ();
windows_thread_info *th = thread_rec (pid, TRUE); windows_thread_info *th = thread_rec (pid, TRUE);
/* Check if TH exists. Windows sometimes uses a non-existent /* Check if TH exists. Windows sometimes uses a non-existent
@ -625,7 +625,7 @@ windows_store_one_register (const struct regcache *regcache,
void void
windows_nat_target::store_registers (struct regcache *regcache, int r) windows_nat_target::store_registers (struct regcache *regcache, int r)
{ {
DWORD pid = ptid_get_tid (regcache->ptid ()); DWORD pid = regcache->ptid ().tid ();
windows_thread_info *th = thread_rec (pid, TRUE); windows_thread_info *th = thread_rec (pid, TRUE);
/* Check if TH exists. Windows sometimes uses a non-existent /* Check if TH exists. Windows sometimes uses a non-existent
@ -1429,10 +1429,10 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
last_sig = GDB_SIGNAL_0; last_sig = GDB_SIGNAL_0;
DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n", DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
ptid.pid (), ptid_get_tid (ptid), step, sig)); ptid.pid (), ptid.tid (), step, sig));
/* Get context for currently selected thread. */ /* Get context for currently selected thread. */
th = thread_rec (ptid_get_tid (inferior_ptid), FALSE); th = thread_rec (inferior_ptid.tid (), FALSE);
if (th) if (th)
{ {
if (step) if (step)
@ -1466,7 +1466,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (resume_all) if (resume_all)
windows_continue (continue_status, -1, 0); windows_continue (continue_status, -1, 0);
else else
windows_continue (continue_status, ptid_get_tid (ptid), 0); windows_continue (continue_status, ptid.tid (), 0);
} }
/* Ctrl-C handler used when the inferior is not run in the same console. The /* Ctrl-C handler used when the inferior is not run in the same console. The
@ -2917,10 +2917,10 @@ windows_nat_target::pid_to_str (ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
if (ptid_get_tid (ptid) != 0) if (ptid.tid () != 0)
{ {
snprintf (buf, sizeof (buf), "Thread %d.0x%lx", snprintf (buf, sizeof (buf), "Thread %d.0x%lx",
ptid.pid (), ptid_get_tid (ptid)); ptid.pid (), ptid.tid ());
return buf; return buf;
} }
@ -3007,7 +3007,7 @@ windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
{ {
windows_thread_info *th; windows_thread_info *th;
th = thread_rec (ptid_get_tid (ptid), 0); th = thread_rec (ptid.tid (), 0);
if (th == NULL) if (th == NULL)
return false; return false;
@ -3028,7 +3028,7 @@ windows_nat_target::get_ada_task_ptid (long lwp, long thread)
const char * const char *
windows_nat_target::thread_name (struct thread_info *thr) windows_nat_target::thread_name (struct thread_info *thr)
{ {
return thread_rec (ptid_get_tid (thr->ptid), 0)->name; return thread_rec (thr->ptid.tid (), 0)->name;
} }
@ -3188,8 +3188,8 @@ windows_nat_target::thread_alive (ptid_t ptid)
{ {
int tid; int tid;
gdb_assert (ptid_get_tid (ptid) != 0); gdb_assert (ptid.tid () != 0);
tid = ptid_get_tid (ptid); tid = ptid.tid ();
return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) != WAIT_OBJECT_0; return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) != WAIT_OBJECT_0;
} }