From patchwork Wed Jun 13 21:50:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27817 Received: (qmail 42217 invoked by alias); 13 Jun 2018 21:51:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 42106 invoked by uid 89); 13 Jun 2018 21:51:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.47.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 21:51:10 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 30B9E400D7F3B for ; Wed, 13 Jun 2018 16:51:09 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id TDfJfhN55bXuJTDfRfvGEx; Wed, 13 Jun 2018 16:51:08 -0500 X-Authority-Reason: nr=8 Received: from [12.176.89.6] (port=50304 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fTDfJ-001rOd-5T; Wed, 13 Jun 2018 16:50:53 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 05/10] Remove ptid_get_tid Date: Wed, 13 Jun 2018 14:50:44 -0700 Message-Id: <20180613215049.9691-6-tom@tromey.com> In-Reply-To: <20180613215049.9691-1-tom@tromey.com> References: <20180613215049.9691-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fTDfJ-001rOd-5T X-Source-Sender: (localhost.localdomain) [12.176.89.6]:50304 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes ptid_get_tid in favor of calling the ptid_t::tid method. ChangeLog 2018-06-13 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. gdbserver/ChangeLog 2018-06-13 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 6d5e42d1b1..022ff24664 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2018-06-13 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-06-13 Tom Tromey * common/ptid.c (ptid_get_lwp): Remove. diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index ff98eeffab..a75aa0f9f1 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 26db82b179..31ba760912 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 c7fb671ec6..94d8a2ded1 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. */ @@ -436,7 +436,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) { @@ -472,7 +472,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); @@ -514,7 +514,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) { @@ -532,12 +532,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 85cb4ca81c..11ef61cf58 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 5eeecdd9f9..e5cc726293 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 4337b51a02..7f6441d273 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -928,7 +928,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; @@ -955,7 +955,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); @@ -1170,7 +1170,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)) @@ -1197,7 +1197,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) @@ -1889,7 +1889,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); @@ -1945,7 +1945,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 ab16d1cbec..2adb7a437f 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 938b76a2d6..a2da59f858 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-06-13 Tom Tromey + + * target.c: Update. + 2018-06-13 Tom Tromey * linux-low.c: Update. diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index aff316da22..81d7cc471a 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 fbe6668bff..2304f4a6d3 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 18bdd39bfd..b53d1dcb62 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3433,14 +3433,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 ()); @@ -4397,7 +4397,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. */ @@ -4635,7 +4635,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 12455a79f6..5edf2ef200 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 53797c8981..d140068c05 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 7b83e451ff..1b2e3925c2 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 a24d1f4a3a..9d006006b4 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 fccb37ebda..0e6b9eb88c 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 c5540577f0..95248f2c17 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 0b4d68a4a4..b076232e04 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 440211a1db..08652a6754 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)); @@ -582,7 +582,7 @@ do_windows_fetch_inferior_registers (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 @@ -610,7 +610,7 @@ do_windows_store_inferior_registers (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 @@ -1408,10 +1408,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) @@ -1445,7 +1445,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 @@ -2896,10 +2896,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; } @@ -2986,7 +2986,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; @@ -3007,7 +3007,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; } @@ -3167,8 +3167,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; }