From cc6bcb548d67a5a0a7223d81bd43c299312320c8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 11 Jun 2018 12:14:34 -0600 Subject: [PATCH] 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 * 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 * target.c: Update. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/ada-tasks.c | 2 +- gdb/aix-thread.c | 8 ++++---- gdb/bsd-uthread.c | 18 +++++++++--------- gdb/common/ptid.c | 8 -------- gdb/common/ptid.h | 4 ---- gdb/darwin-nat.c | 12 ++++++------ gdb/fbsd-nat.c | 2 +- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/target.c | 4 ++-- gdb/i386-darwin-nat.c | 8 ++++---- gdb/infrun.c | 8 ++++---- gdb/linux-tdep.c | 2 +- gdb/nto-procfs.c | 6 +++--- gdb/ppc-ravenscar-thread.c | 4 ++-- gdb/python/py-infthread.c | 2 +- gdb/ravenscar-thread.c | 4 ++-- gdb/sol-thread.c | 20 ++++++++++---------- gdb/sparc-ravenscar-thread.c | 4 ++-- gdb/windows-nat.c | 30 +++++++++++++++--------------- 20 files changed, 91 insertions(+), 79 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1cebccc12de..e0a3322e257 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2018-07-03 Tom Tromey + + * 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 * common/ptid.c (ptid_get_lwp): Remove. diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 8c4587923e5..04f286ed561 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1203,7 +1203,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf) printf_filtered (_("\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. */ diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index c8791bde38d..97592e5b1f7 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -70,7 +70,7 @@ static int debug_aix_thread; /* 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. */ @@ -677,9 +677,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2) 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; @@ -1766,7 +1766,7 @@ aix_thread_target::pid_to_str (ptid_t ptid) xstrprintf(). */ xfree (ret); - ret = xstrprintf (_("Thread %ld"), ptid_get_tid (ptid)); + ret = xstrprintf (_("Thread %ld"), ptid.tid ()); return ret; } diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 84370813eff..3229a180556 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -321,7 +321,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum) 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); @@ -353,7 +353,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum) 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); @@ -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 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. */ @@ -437,7 +437,7 @@ bool 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) { @@ -474,7 +474,7 @@ bsd_uthread_target::update_thread_list () /* 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); @@ -516,7 +516,7 @@ const char * 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) { @@ -534,12 +534,12 @@ bsd_uthread_target::extra_thread_info (thread_info *info) 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; } diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index 85cb4ca81c8..11ef61cf582 100644 --- a/gdb/common/ptid.c +++ b/gdb/common/ptid.c @@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one (); /* 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) { diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index 5eeecdd9f91..e5cc7262931 100644 --- a/gdb/common/ptid.h +++ b/gdb/common/ptid.h @@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid; /* 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); diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 70eaf083aed..9015f32bc10 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -930,7 +930,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal) 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; @@ -957,7 +957,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal) 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); @@ -1172,7 +1172,7 @@ cancel_breakpoint (ptid_t ptid) 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)) @@ -1199,7 +1199,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status) 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) @@ -1906,7 +1906,7 @@ darwin_nat_target::attach (const char *args, int from_tty) 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); @@ -1962,7 +1962,7 @@ const char * 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) { diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 8ce55c19d1f..474d6ae173c 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1101,7 +1101,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) 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. */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 602d4f12ad7..5ecaf48a202 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-07-03 Tom Tromey + + * target.c: Update. + 2018-07-03 Tom Tromey * linux-low.c: Update. diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index aff316da22a..81d7cc471a6 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -318,9 +318,9 @@ target_pid_to_str (ptid_t ptid) xsnprintf (buf, sizeof (buf), ""); else if (ptid_equal (ptid, null_ptid)) xsnprintf (buf, sizeof (buf), ""); - 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 ()); diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c index fbe6668bfff..2304f4a6d3e 100644 --- a/gdb/i386-darwin-nat.c +++ b/gdb/i386-darwin-nat.c @@ -59,7 +59,7 @@ static struct i386_darwin_nat_target darwin_target; 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 (); @@ -175,7 +175,7 @@ void 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 @@ -288,7 +288,7 @@ i386_darwin_dr_set (int regnum, CORE_ADDR value) 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; @@ -377,7 +377,7 @@ i386_darwin_dr_get (int regnum) 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; diff --git a/gdb/infrun.c b/gdb/infrun.c index b3a6a38a3d0..91c7d1e61da 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3424,14 +3424,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid, 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 ()); @@ -4378,7 +4378,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws) statstr.c_str (), tp->ptid.pid (), tp->ptid.lwp (), - ptid_get_tid (tp->ptid)); + tp->ptid.tid ()); } /* Record for later. */ @@ -4615,7 +4615,7 @@ stop_all_threads (void) statstr.c_str (), t->ptid.pid (), t->ptid.lwp (), - ptid_get_tid (t->ptid)); + t->ptid.tid ()); } /* Record for later. */ diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 12455a79f6d..5edf2ef2005 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -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. */ 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, diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 53797c8981a..d140068c05d 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -296,7 +296,7 @@ procfs_set_thread (ptid_t ptid) { pid_t tid; - tid = ptid_get_tid (ptid); + tid = ptid.tid (); 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; int err; - tid = ptid_get_tid (ptid); + tid = ptid.tid (); pid = ptid.pid (); if (kill (pid, 0) == -1) @@ -1469,7 +1469,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid) struct tidinfo *tip; pid = ptid.pid (); - tid = ptid_get_tid (ptid); + tid = ptid.tid (); n = snprintf (buf, 1023, "process %d", pid); diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c index 7b83e451ff2..1b2e3925c2e 100644 --- a/gdb/ppc-ravenscar-thread.c +++ b/gdb/ppc-ravenscar-thread.c @@ -154,7 +154,7 @@ ppc_ravenscar_generic_fetch_registers 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++) @@ -193,7 +193,7 @@ ppc_ravenscar_generic_store_registers 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; diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 7e409bb389e..36ae71b6358 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -268,7 +268,7 @@ gdbpy_create_ptid_object (ptid_t ptid) 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)); diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index fccb37ebda9..0e6b9eb88c9 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid) 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, @@ -405,7 +405,7 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid) { 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; } diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index c5540577f0d..95248f2c17f 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -305,7 +305,7 @@ thread_to_lwp (ptid_t thread_id, int default_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) return ptid_t (-1); /* Thread must have terminated. */ 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.")); 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); @@ -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.")); 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); @@ -494,7 +494,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum) } /* 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")); @@ -546,7 +546,7 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum) } /* 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) @@ -704,7 +704,7 @@ sol_thread_target::thread_alive (ptid_t ptid) 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) @@ -1011,13 +1011,13 @@ sol_thread_target::pid_to_str (ptid_t ptid) 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 ()); @@ -1157,7 +1157,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data) { long *tid = (long *) data; - if (ptid_get_tid (thread->ptid) == *tid) + if (thread->ptid.tid () == *tid) return 1; return 0; diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c index 0b4d68a4a42..b076232e042 100644 --- a/gdb/sparc-ravenscar-thread.c +++ b/gdb/sparc-ravenscar-thread.c @@ -112,7 +112,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum) 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 @@ -162,7 +162,7 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum) 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, diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 1befc3f01b5..532d5fdd156 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -427,9 +427,9 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb) 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; @@ -484,9 +484,9 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code) 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)); @@ -555,7 +555,7 @@ windows_fetch_one_register (struct regcache *regcache, 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 @@ -625,7 +625,7 @@ windows_store_one_register (const struct regcache *regcache, 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 @@ -1429,10 +1429,10 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) 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) @@ -1466,7 +1466,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) 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 @@ -2917,10 +2917,10 @@ windows_nat_target::pid_to_str (ptid_t ptid) { 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; } @@ -3007,7 +3007,7 @@ windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) { windows_thread_info *th; - th = thread_rec (ptid_get_tid (ptid), 0); + th = thread_rec (ptid.tid (), 0); if (th == NULL) return false; @@ -3028,7 +3028,7 @@ windows_nat_target::get_ada_task_ptid (long lwp, long thread) 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; } @@ -3188,8 +3188,8 @@ windows_nat_target::thread_alive (ptid_t ptid) { 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; } -- 2.30.2