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.
+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>
* common/ptid.c (ptid_get_lwp): Remove.
printf_filtered (_("<no name>\n"));
/* 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 ());
/* If set, print the base CPU. */
/* 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_BAD_USER errors, so use 1. */
return -1;
else if (ptid1.pid () > ptid2.pid ())
return 1;
- else if (ptid_get_tid (ptid1) < ptid_get_tid (ptid2))
+ else if (ptid1.tid () < ptid2.tid ())
return -1;
- else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2))
+ else if (ptid1.tid () > ptid2.tid ())
return 1;
else if (ptid1.lwp () < ptid2.lwp ())
return -1;
xstrprintf(). */
xfree (ret);
- ret = xstrprintf (_("Thread %ld"), ptid_get_tid (ptid));
+ ret = xstrprintf (_("Thread %ld"), ptid.tid ());
return ret;
}
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
ptid_t ptid = regcache->ptid ();
- CORE_ADDR addr = ptid_get_tid (ptid);
+ CORE_ADDR addr = ptid.tid ();
CORE_ADDR active_addr;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
ptid_t ptid = regcache->ptid ();
- CORE_ADDR addr = ptid_get_tid (ptid);
+ CORE_ADDR addr = ptid.tid ();
CORE_ADDR active_addr;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
/* 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
the process. Notify GDB core about it. */
- if (ptid_get_tid (inferior_ptid) == 0
- && ptid_get_tid (ptid) != 0 && !in_thread_list (ptid))
+ if (inferior_ptid.tid () == 0
+ && ptid.tid () != 0 && !in_thread_list (ptid))
thread_change_ptid (inferior_ptid, ptid);
/* Don't let the core see a ptid without a corresponding thread. */
bsd_uthread_target::thread_alive (ptid_t ptid)
{
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 INFERIOR_PTID doesn't have a tid member yet, then ptid
is still the initial thread of the process. Notify GDB
core about it. */
- if (ptid_get_tid (inferior_ptid) == 0)
+ if (inferior_ptid.tid () == 0)
thread_change_ptid (inferior_ptid, ptid);
else
add_thread (ptid);
bsd_uthread_target::extra_thread_info (thread_info *info)
{
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)
{
const char *
bsd_uthread_target::pid_to_str (ptid_t ptid)
{
- if (ptid_get_tid (ptid) != 0)
+ if (ptid.tid () != 0)
{
static char buf[64];
xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
- ptid.pid (), ptid_get_tid (ptid));
+ ptid.pid (), ptid.tid ());
return buf;
}
/* See ptid.h. */
-long
-ptid_get_tid (const ptid_t &ptid)
-{
- return ptid.tid ();
-}
-
-/* See ptid.h. */
-
int
ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2)
{
/* The following functions are kept for backwards compatibility. The use of
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!=. */
extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2);
inferior_debug
(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)
nsignal = 0;
else
{
struct inferior *inf = find_inferior_ptid (ptid);
- long tid = ptid_get_tid (ptid);
+ long tid = ptid.tid ();
/* Stop the inferior (should be useless). */
darwin_suspend_inferior (inf);
if (breakpoint_inserted_here_p (regcache->aspace (), pc))
{
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. */
if (gdbarch_decr_pc_after_break (gdbarch))
inferior_debug
(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. */
if (darwin_inf_fake_stop != NULL)
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_nat_target::pid_to_str (ptid_t ptid)
{
static char buf[80];
- long tid = ptid_get_tid (ptid);
+ long tid = ptid.tid ();
if (tid != 0)
{
fprintf_unfiltered (gdb_stdlog,
"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
ptid.pid (), ptid.lwp (),
- ptid_get_tid (ptid));
+ ptid.tid ());
if (ptid_lwp_p (ptid))
{
/* If ptid is a specific LWP, suspend all other LWPs in the process. */
+2018-07-03 Tom Tromey <tom@tromey.com>
+
+ * target.c: Update.
+
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
xsnprintf (buf, sizeof (buf), "<all threads>");
else if (ptid_equal (ptid, null_ptid))
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",
- ptid.pid (), ptid_get_tid (ptid));
+ ptid.pid (), ptid.tid ());
else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
ptid.pid (), ptid.lwp ());
void
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;
struct gdbarch *gdbarch = regcache->arch ();
i386_darwin_nat_target::store_registers (struct regcache *regcache,
int regno)
{
- thread_t current_thread = ptid_get_tid (regcache->ptid ());
+ thread_t current_thread = regcache->ptid ().tid ();
struct gdbarch *gdbarch = regcache->arch ();
#ifdef BFD64
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.count = x86_DEBUG_STATE_COUNT;
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.count = x86_DEBUG_STATE_COUNT;
stb.printf ("infrun: target_wait (%d.%ld.%ld",
waiton_ptid.pid (),
waiton_ptid.lwp (),
- ptid_get_tid (waiton_ptid));
+ waiton_ptid.tid ());
if (waiton_ptid.pid () != -1)
stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
stb.printf (", status) =\n");
stb.printf ("infrun: %d.%ld.%ld [%s],\n",
result_ptid.pid (),
result_ptid.lwp (),
- ptid_get_tid (result_ptid),
+ result_ptid.tid (),
target_pid_to_str (result_ptid));
stb.printf ("infrun: %s\n", status_string.c_str ());
statstr.c_str (),
tp->ptid.pid (),
tp->ptid.lwp (),
- ptid_get_tid (tp->ptid));
+ tp->ptid.tid ());
}
/* Record for later. */
statstr.c_str (),
t->ptid.pid (),
t->ptid.lwp (),
- ptid_get_tid (t->ptid));
+ t->ptid.tid ());
}
/* Record for later. */
/* For remote targets the LWP may not be available, so use the TID. */
data.lwp = ptid.lwp ();
if (!data.lwp)
- data.lwp = ptid_get_tid (ptid);
+ data.lwp = ptid.tid ();
gdbarch_iterate_over_regset_sections (gdbarch,
linux_collect_regset_section_cb,
{
pid_t tid;
- tid = ptid_get_tid (ptid);
+ tid = ptid.tid ();
devctl (ctl_fd, DCMD_PROC_CURTHREAD, &tid, sizeof (tid), 0);
}
procfs_status status;
int err;
- tid = ptid_get_tid (ptid);
+ tid = ptid.tid ();
pid = ptid.pid ();
if (kill (pid, 0) == -1)
struct tidinfo *tip;
pid = ptid.pid ();
- tid = ptid_get_tid (ptid);
+ tid = ptid.tid ();
n = snprintf (buf, 1023, "process %d", pid);
CORE_ADDR thread_descriptor_address;
/* 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. */
for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
if (register_in_thread_descriptor_p (reg_info, regnum))
register_address
- = ptid_get_tid (inferior_ptid) + reg_info->context_offsets [regnum];
+ = inferior_ptid.tid () + reg_info->context_offsets [regnum];
else
return;
pid = ptid.pid ();
lwp = ptid.lwp ();
- tid = ptid_get_tid (ptid);
+ tid = ptid.tid ();
PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (lwp));
2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
query, which the remote protocol layer then treats as a thread
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,
{
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;
}
/* 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)
return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
error (_("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"),
- ptid_get_tid (save_ptid));
+ save_ptid.tid ());
}
beneath ()->resume (ptid, step, signo);
error (_("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"),
- ptid_get_tid (save_ptid));
+ save_ptid.tid ());
}
rtnval = beneath ()->wait (ptid, ourstatus, options);
}
/* Solaris thread: convert PTID into a td_thrhandle_t. */
- thread = ptid_get_tid (ptid);
+ thread = ptid.tid ();
if (thread == 0)
error (_("sol_thread_fetch_registers: thread == 0"));
}
/* 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);
if (val != TD_OK)
td_thrhandle_t th;
int pid;
- pid = ptid_get_tid (ptid);
+ pid = ptid.tid ();
if ((val = p_td_ta_map_id2thr (main_ta, pid, &th)) != TD_OK)
return false; /* Thread not found. */
if ((val = p_td_thr_validate (&th)) != TD_OK)
if (lwp.pid () == -1)
xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
- ptid_get_tid (ptid));
+ ptid.tid ());
else if (lwp.pid () != -2)
xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
- ptid_get_tid (ptid), lwp.lwp ());
+ ptid.tid (), lwp.lwp ());
else
xsnprintf (buf, sizeof (buf), "Thread %ld ",
- ptid_get_tid (ptid));
+ ptid.tid ());
}
else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid.lwp ());
{
long *tid = (long *) data;
- if (ptid_get_tid (thread->ptid) == *tid)
+ if (thread->ptid.tid () == *tid)
return 1;
return 0;
ULONGEST stack_address;
/* 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. */
current_address = thread_descriptor_address
if (register_in_thread_descriptor_p (regnum))
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))
{
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,
windows_thread_info *th;
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)))
return th;
windows_thread_info *th;
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)
printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid));
void
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);
/* Check if TH exists. Windows sometimes uses a non-existent
void
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);
/* Check if TH exists. Windows sometimes uses a non-existent
last_sig = GDB_SIGNAL_0;
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. */
- th = thread_rec (ptid_get_tid (inferior_ptid), FALSE);
+ th = thread_rec (inferior_ptid.tid (), FALSE);
if (th)
{
if (step)
if (resume_all)
windows_continue (continue_status, -1, 0);
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
{
static char buf[80];
- if (ptid_get_tid (ptid) != 0)
+ if (ptid.tid () != 0)
{
snprintf (buf, sizeof (buf), "Thread %d.0x%lx",
- ptid.pid (), ptid_get_tid (ptid));
+ ptid.pid (), ptid.tid ());
return buf;
}
{
windows_thread_info *th;
- th = thread_rec (ptid_get_tid (ptid), 0);
+ th = thread_rec (ptid.tid (), 0);
if (th == NULL)
return false;
const char *
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;
}
{
int tid;
- gdb_assert (ptid_get_tid (ptid) != 0);
- tid = ptid_get_tid (ptid);
+ gdb_assert (ptid.tid () != 0);
+ tid = ptid.tid ();
return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) != WAIT_OBJECT_0;
}