diff options
author | Tom Tromey <tom@tromey.com> | 2018-06-11 11:25:49 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-03 11:36:42 -0600 |
commit | f2907e49910853edf3c1aec995b3c44b3bba8999 (patch) | |
tree | 7352a0fdbe482ea1e7c60ed5bc37f00ceb17287d | |
parent | fd79271bd9dd6bb1626fb6f5ec3a415dc24950b1 (diff) | |
download | gdb-f2907e49910853edf3c1aec995b3c44b3bba8999.zip gdb-f2907e49910853edf3c1aec995b3c44b3bba8999.tar.gz gdb-f2907e49910853edf3c1aec995b3c44b3bba8999.tar.bz2 |
Remove pid_to_ptid
This removes pid_to_ptid in favor of calling the ptid_t constructor
directly.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (pid_to_ptid): Remove.
* common/ptid.h (pid_to_ptid): Don't declare.
* aix-thread.c: Update.
* arm-linux-nat.c: Update.
* common/ptid.c: Update.
* common/ptid.h: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fork-child.c: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/fork-inferior.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* procfs.c: Update.
* progspace.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* spu-linux-nat.c: Update.
* target.c: Update.
* top.c: Update.
* tracefile-tfile.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-ppc-low.c: Update.
* linux-x86-low.c: Update.
* proc-service.c: Update.
* server.c: Update.
* spu-low.c: Update.
* thread-db.c: Update.
* win32-low.c: Update.
43 files changed, 176 insertions, 139 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 55e0bf9..da383cd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,43 @@ 2018-07-03 Tom Tromey <tom@tromey.com> + * common/ptid.c (pid_to_ptid): Remove. + * common/ptid.h (pid_to_ptid): Don't declare. + * aix-thread.c: Update. + * arm-linux-nat.c: Update. + * common/ptid.c: Update. + * common/ptid.h: Update. + * corelow.c: Update. + * ctf.c: Update. + * darwin-nat.c: Update. + * fbsd-nat.c: Update. + * fork-child.c: Update. + * gnu-nat.c: Update. + * go32-nat.c: Update. + * inf-ptrace.c: Update. + * infcmd.c: Update. + * inferior.c: Update. + * infrun.c: Update. + * linux-fork.c: Update. + * linux-nat.c: Update. + * nat/aarch64-linux-hw-point.c: Update. + * nat/fork-inferior.c: Update. + * nat/x86-linux-dregs.c: Update. + * nto-procfs.c: Update. + * obsd-nat.c: Update. + * procfs.c: Update. + * progspace.c: Update. + * remote.c: Update. + * rs6000-nat.c: Update. + * s390-linux-nat.c: Update. + * sol-thread.c: Update. + * spu-linux-nat.c: Update. + * target.c: Update. + * top.c: Update. + * tracefile-tfile.c: Update. + * windows-nat.c: Update. + +2018-07-03 Tom Tromey <tom@tromey.com> + * common/ptid.h (ptid_build): Don't declare. * common/ptid.c (ptid_build): Remove. * aix-thread.c: Update. diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 589e585..b977862 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -325,7 +325,7 @@ pid_to_prc (ptid_t *ptidp) ptid = *ptidp; if (PD_TID (ptid)) - *ptidp = pid_to_ptid (ptid_get_pid (ptid)); + *ptidp = ptid_t (ptid_get_pid (ptid)); } /* pthdb callback: for <i> from 0 to COUNT, set SYMBOLS[<i>].addr to @@ -1042,7 +1042,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig) { scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); - inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid)); beneath ()->resume (ptid, step, sig); } else @@ -1082,12 +1082,12 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status, pid_to_prc (&ptid); - inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid)); ptid = beneath ()->wait (ptid, status, options); } if (ptid_get_pid (ptid) == -1) - return pid_to_ptid (-1); + return ptid_t (-1); /* Check whether libpthdebug might be ready to be initialized. */ if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED @@ -1722,7 +1722,7 @@ aix_thread_target::xfer_partial (enum target_object object, { scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); - inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid)); return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset, len, xfered_len); } diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index d0b4313..b5ee3a9 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -994,7 +994,7 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt, struct update_registers_data data; pid = ptid_get_pid (inferior_ptid); - pid_ptid = pid_to_ptid (pid); + pid_ptid = ptid_t (pid); if (watchpoint) { @@ -1033,7 +1033,7 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt, struct update_registers_data data; pid = ptid_get_pid (inferior_ptid); - pid_ptid = pid_to_ptid (pid); + pid_ptid = ptid_t (pid); if (watchpoint) { diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index 49d27b4..42e51d2 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. */ -ptid_t -pid_to_ptid (int pid) -{ - return ptid_t (pid); -} - -/* See ptid.h. */ - int ptid_get_pid (const ptid_t &ptid) { diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index 030e97d..5591690 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::ptid_t. */ - -extern ptid_t pid_to_ptid (int pid); - /* See ptid_t::pid. */ extern int ptid_get_pid (const ptid_t &ptid); diff --git a/gdb/corelow.c b/gdb/corelow.c index f9185e1..ff0526d 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -457,7 +457,7 @@ core_target_open (const char *arg, int from_tty) if (thread == NULL) { inferior_appeared (current_inferior (), CORELOW_PID); - inferior_ptid = pid_to_ptid (CORELOW_PID); + inferior_ptid = ptid_t (CORELOW_PID); add_thread_silent (inferior_ptid); } else @@ -1007,7 +1007,7 @@ core_target::pid_to_str (ptid_t ptid) /* Try the LWPID field first. */ pid = ptid_get_lwp (ptid); if (pid != 0) - return normal_pid_to_str (pid_to_ptid (pid)); + return normal_pid_to_str (ptid_t (pid)); /* Otherwise, this isn't a "threaded" core -- use the PID field, but only if it isn't a fake PID. */ @@ -1160,7 +1160,7 @@ ctf_target_open (const char *dirname, int from_tty) push_target (&ctf_ops); inferior_appeared (current_inferior (), CTF_PID); - inferior_ptid = pid_to_ptid (CTF_PID); + inferior_ptid = ptid_t (CTF_PID); add_thread_silent (inferior_ptid); merge_uploaded_trace_state_variables (&uploaded_tsvs); diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index c306d37..b82124d 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1881,10 +1881,10 @@ darwin_nat_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); else printf_unfiltered (_("Attaching to %s\n"), - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } @@ -1893,7 +1893,7 @@ darwin_nat_target::attach (const char *args, int from_tty) error (_("Can't attach to process %d: %s (%d)"), pid, safe_strerror (errno), errno); - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); inf = current_inferior (); inferior_appeared (inf, pid); inf->attach_flag = 1; diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 8d68c72..e46645a 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -926,7 +926,7 @@ fbsd_add_threads (pid_t pid) { int i, nlwps; - gdb_assert (!in_thread_list (pid_to_ptid (pid))); + gdb_assert (!in_thread_list (ptid_t (pid))); nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0); if (nlwps == -1) perror_with_name (("ptrace")); @@ -1298,13 +1298,13 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, PL_FLAG_BORN in case the first stop reported after attaching to an existing process is a PL_FLAG_BORN event. */ - if (in_thread_list (pid_to_ptid (pid))) + if (in_thread_list (ptid_t (pid))) { if (debug_fbsd_lwp) fprintf_unfiltered (gdb_stdlog, "FLWP: using LWP %u for first thread\n", pl.pl_lwpid); - thread_change_ptid (pid_to_ptid (pid), wptid); + thread_change_ptid (ptid_t (pid), wptid); } #ifdef PT_LWP_EVENTS diff --git a/gdb/fork-child.c b/gdb/fork-child.c index e1719a0..1de96b6 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -88,7 +88,7 @@ postfork_hook (pid_t pid) inferior_appeared (inf, pid); /* Needed for wait_for_inferior stuff. */ - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); gdb_assert (saved_ui != NULL); current_ui = saved_ui; diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index c20f222..71f3e16 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,6 +1,17 @@ 2018-07-03 Tom Tromey <tom@tromey.com> * linux-low.c: Update. + * linux-ppc-low.c: Update. + * linux-x86-low.c: Update. + * proc-service.c: Update. + * server.c: Update. + * spu-low.c: Update. + * thread-db.c: Update. + * win32-low.c: Update. + +2018-07-03 Tom Tromey <tom@tromey.com> + + * linux-low.c: Update. * lynx-low.c: Update. * nto-low.c: Update. * remote-utils.c: Update. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index ce4d660..a5e0d5b 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1226,13 +1226,13 @@ linux_attach (unsigned long pid) { struct lwp_info *lwp; int wstat, lwpid; - ptid_t pid_ptid = pid_to_ptid (pid); + ptid_t pid_ptid = ptid_t (pid); lwpid = linux_wait_for_event_filtered (pid_ptid, pid_ptid, &wstat, __WALL); gdb_assert (lwpid > 0); - lwp = find_lwp_pid (pid_to_ptid (lwpid)); + lwp = find_lwp_pid (ptid_t (lwpid)); if (!WIFSTOPPED (wstat) || WSTOPSIG (wstat) != SIGSTOP) { @@ -1405,7 +1405,7 @@ linux_kill (int pid) /* See the comment in linux_kill_one_lwp. We did not kill the first thread in the list, so do so now. */ - lwp = find_lwp_pid (pid_to_ptid (pid)); + lwp = find_lwp_pid (ptid_t (pid)); if (lwp == NULL) { @@ -1640,7 +1640,7 @@ linux_detach (int pid) able to reap the leader. */ for_each_thread (pid, linux_detach_lwp_callback); - main_lwp = find_lwp_pid (pid_to_ptid (pid)); + main_lwp = find_lwp_pid (ptid_t (pid)); linux_detach_one_lwp (main_lwp); the_target->mourn (process); @@ -1878,7 +1878,7 @@ check_zombie_leaders (void) pid_t leader_pid = pid_of (proc); struct lwp_info *leader_lp; - leader_lp = find_lwp_pid (pid_to_ptid (leader_pid)); + leader_lp = find_lwp_pid (ptid_t (leader_pid)); if (debug_threads) debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, " @@ -2363,7 +2363,7 @@ linux_low_filter_event (int lwpid, int wstat) struct thread_info *thread; int have_stop_pc = 0; - child = find_lwp_pid (pid_to_ptid (lwpid)); + child = find_lwp_pid (ptid_t (lwpid)); /* Check for stop events reported by a process we didn't already know about - anything not already in our LWP list. diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index c6e00b7..47428c1 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -703,7 +703,7 @@ ppc_supports_tracepoints (void) static int ppc_get_thread_area (int lwpid, CORE_ADDR *addr) { - struct lwp_info *lwp = find_lwp_pid (pid_to_ptid (lwpid)); + struct lwp_info *lwp = find_lwp_pid (ptid_t (lwpid)); struct thread_info *thr = get_lwp_thread (lwp); struct regcache *regcache = get_thread_regcache (thr, 1); ULONGEST tp = 0; diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 408b54f..80b4380 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -255,7 +255,7 @@ x86_get_thread_area (int lwpid, CORE_ADDR *addr) #endif { - struct lwp_info *lwp = find_lwp_pid (pid_to_ptid (lwpid)); + struct lwp_info *lwp = find_lwp_pid (ptid_t (lwpid)); struct thread_info *thr = get_lwp_thread (lwp); struct regcache *regcache = get_thread_regcache (thr, 1); unsigned int desc[4]; diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c index f7912b8..64fdf8a 100644 --- a/gdb/gdbserver/proc-service.c +++ b/gdb/gdbserver/proc-service.c @@ -108,7 +108,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset) struct thread_info *reg_thread, *saved_thread; struct regcache *regcache; - lwp = find_lwp_pid (pid_to_ptid (lwpid)); + lwp = find_lwp_pid (ptid_t (lwpid)); if (lwp == NULL) return PS_ERR; diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index e4de426..c2f7287 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -308,7 +308,7 @@ attach_inferior (int pid) if (!non_stop) { - cs.last_ptid = mywait (pid_to_ptid (pid), &cs.last_status, 0, 0); + cs.last_ptid = mywait (ptid_t (pid), &cs.last_status, 0, 0); /* GDB knows to ignore the first SIGSTOP after attaching to a running process using the "attach" command, but this is different; it's @@ -1256,7 +1256,7 @@ handle_detach (char *own_buf) write_enn (own_buf); else { - discard_queued_stop_replies (pid_to_ptid (pid)); + discard_queued_stop_replies (ptid_t (pid)); write_ok (own_buf); if (extended_protocol || target_running ()) @@ -1266,7 +1266,7 @@ handle_detach (char *own_buf) and instead treat this like a normal program exit. */ cs.last_status.kind = TARGET_WAITKIND_EXITED; cs.last_status.value.integer = 0; - cs.last_ptid = pid_to_ptid (pid); + cs.last_ptid = ptid_t (pid); current_thread = NULL; } @@ -3081,7 +3081,7 @@ handle_v_kill (char *own_buf) { cs.last_status.kind = TARGET_WAITKIND_SIGNALLED; cs.last_status.value.sig = GDB_SIGNAL_KILL; - cs.last_ptid = pid_to_ptid (pid); + cs.last_ptid = ptid_t (pid); discard_queued_stop_replies (cs.last_ptid); write_ok (own_buf); return 1; @@ -3481,7 +3481,7 @@ kill_inferior_callback (process_info *process) int pid = process->pid; kill_inferior (pid); - discard_queued_stop_replies (pid_to_ptid (pid)); + discard_queued_stop_replies (ptid_t (pid)); } /* Call this when exiting gdbserver with possible inferiors that need @@ -3527,7 +3527,7 @@ detach_or_kill_for_exit (void) else kill_inferior (pid); - discard_queued_stop_replies (pid_to_ptid (pid)); + discard_queued_stop_replies (ptid_t (pid)); }); } diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c index 13f2b35..8a221a2 100644 --- a/gdb/gdbserver/spu-low.c +++ b/gdb/gdbserver/spu-low.c @@ -457,7 +457,7 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) ourstatus->kind = TARGET_WAITKIND_EXITED; ourstatus->value.integer = WEXITSTATUS (w); clear_inferiors (); - return pid_to_ptid (ret); + return ptid_t (ret); } else if (!WIFSTOPPED (w)) { @@ -465,7 +465,7 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) ourstatus->kind = TARGET_WAITKIND_SIGNALLED; ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w)); clear_inferiors (); - return pid_to_ptid (ret); + return ptid_t (ret); } /* After attach, we may have received a SIGSTOP. Do not return this diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 3e42db4..80125ee 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -252,7 +252,7 @@ maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p, { struct lwp_info *lwp; - lwp = find_lwp_pid (pid_to_ptid (ti_p->ti_lid)); + lwp = find_lwp_pid (ptid_t (ti_p->ti_lid)); if (lwp != NULL) return 1; diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 05bea69..53b843b 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -707,7 +707,7 @@ win32_create_inferior (const char *program, /* Wait till we are at 1st instruction in program, return new pid (assuming success). */ - cs.last_ptid = win32_wait (pid_to_ptid (current_process_id), &cs.last_status, 0); + cs.last_ptid = win32_wait (ptid_t (current_process_id), &cs.last_status, 0); return current_process_id; } @@ -1612,7 +1612,7 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) OUTMSG2 (("Child exited with retcode = %x\n", ourstatus->value.integer)); win32_clear_inferiors (); - return pid_to_ptid (current_event.dwProcessId); + return ptid_t (current_event.dwProcessId); case TARGET_WAITKIND_STOPPED: case TARGET_WAITKIND_LOADED: OUTMSG2 (("Child Stopped with signal = %d \n", diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 491d725..78276a7 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1100,7 +1100,7 @@ inf_validate_procs (struct inf *inf) /* Tell GDB's generic thread code. */ - if (ptid_equal (inferior_ptid, pid_to_ptid (inf->pid))) + if (ptid_equal (inferior_ptid, ptid_t (inf->pid))) /* This is the first time we're hearing about thread ids, after a fork-child. */ thread_change_ptid (inferior_ptid, ptid); @@ -2148,7 +2148,7 @@ gnu_nat_target::create_inferior (const char *exec_file, /* We have something that executes now. We'll be running through the shell at this point (if startup-with-shell is true), but the pid shouldn't change. */ - add_thread_silent (pid_to_ptid (pid)); + add_thread_silent (ptid_t (pid)); /* Attach to the now stopped child, which is actually a shell... */ inf_debug (inf, "attaching to child: %d", pid); diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 687fd29..849fdb5 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -533,7 +533,7 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status, } } } - return pid_to_ptid (SOME_PID); + return ptid_t (SOME_PID); } static void @@ -752,7 +752,7 @@ go32_nat_target::create_inferior (const char *exec_file, save_npx (); #endif - inferior_ptid = pid_to_ptid (SOME_PID); + inferior_ptid = ptid_t (SOME_PID); inf = current_inferior (); inferior_appeared (inf, SOME_PID); diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 945af83..3b32b67 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -131,7 +131,7 @@ inf_ptrace_target::create_inferior (const char *exec_file, pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL, NULL, NULL, NULL); - ptid = pid_to_ptid (pid); + ptid = ptid_t (pid); /* We have something that executes now. We'll be running through the shell at this point (if startup-with-shell is true), but the pid shouldn't change. */ @@ -213,10 +213,10 @@ inf_ptrace_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); else printf_unfiltered (_("Attaching to %s\n"), - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } @@ -233,7 +233,7 @@ inf_ptrace_target::attach (const char *args, int from_tty) inf = current_inferior (); inferior_appeared (inf, pid); inf->attach_flag = 1; - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); /* Always add a main thread. If some target extends the ptrace target, it should decorate the ptid later with more info. */ @@ -428,7 +428,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, { case PTRACE_FORK: ourstatus->kind = TARGET_WAITKIND_FORKED; - ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); + ourstatus->value.related_pid = ptid_t (pe.pe_other_pid); /* Make sure the other end of the fork is stopped too. */ fpid = waitpid (pe.pe_other_pid, &status, 0); @@ -443,17 +443,17 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, gdb_assert (pe.pe_other_pid == pid); if (fpid == ptid_get_pid (inferior_ptid)) { - ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); - return pid_to_ptid (fpid); + ourstatus->value.related_pid = ptid_t (pe.pe_other_pid); + return ptid_t (fpid); } - return pid_to_ptid (pid); + return ptid_t (pid); } } #endif store_waitstatus (ourstatus, status); - return pid_to_ptid (pid); + return ptid_t (pid); } /* Transfer data via ptrace into process PID's memory from WRITEBUF, or diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 26d5a2a..2be286c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2600,7 +2600,7 @@ kill_command (const char *arg, int from_tty) int pid = current_inferior ()->pid; /* Save the pid as a string before killing the inferior, since that may unpush the current target, and we need the string after. */ - std::string pid_str = target_pid_to_str (pid_to_ptid (pid)); + std::string pid_str = target_pid_to_str (ptid_t (pid)); int infnum = current_inferior ()->num; target_kill (); @@ -2751,7 +2751,7 @@ attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mod Be sure to explicitly stop all threads of the process. This should have no effect on already stopped threads. */ if (non_stop) - target_stop (pid_to_ptid (inferior->pid)); + target_stop (ptid_t (inferior->pid)); else if (target_is_non_stop_p ()) { struct thread_info *thread; @@ -2897,7 +2897,7 @@ attach_command (const char *args, int from_tty) else /* The user requested an `attach', so stop all threads of this inferior. */ - target_stop (pid_to_ptid (ptid_get_pid (inferior_ptid))); + target_stop (ptid_t (ptid_get_pid (inferior_ptid))); } mode = async_exec ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_STOP; diff --git a/gdb/inferior.c b/gdb/inferior.c index 22beea5..b8539d8 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -124,7 +124,7 @@ add_inferior (int pid) if (print_inferior_events) printf_unfiltered (_("[New inferior %d (%s)]\n"), inf->num, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); return inf; } @@ -263,7 +263,7 @@ detach_inferior (inferior *inf) if (print_inferior_events) printf_unfiltered (_("[Inferior %d (%s) detached]\n"), inf->num, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); } void @@ -457,7 +457,7 @@ static const char * inferior_pid_to_str (int pid) { if (pid != 0) - return target_pid_to_str (pid_to_ptid (pid)); + return target_pid_to_str (ptid_t (pid)); else return _("<null>"); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 2eb25c0..b77e40d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -462,7 +462,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \ if (print_inferior_events) { /* Ensure that we have a process ptid. */ - ptid_t process_ptid = pid_to_ptid (ptid_get_pid (child_ptid)); + ptid_t process_ptid = ptid_t (ptid_get_pid (child_ptid)); target_terminal::ours_for_output (); fprintf_filtered (gdb_stdlog, @@ -598,7 +598,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \ if (print_inferior_events) { /* Ensure that we have a process ptid. */ - ptid_t process_ptid = pid_to_ptid (ptid_get_pid (parent_ptid)); + ptid_t process_ptid = ptid_t (ptid_get_pid (parent_ptid)); target_terminal::ours_for_output (); fprintf_filtered (gdb_stdlog, @@ -961,7 +961,7 @@ handle_vfork_child_exec_or_exit (int exec) if (print_inferior_events) { const char *pidstr - = target_pid_to_str (pid_to_ptid (inf->vfork_parent->pid)); + = target_pid_to_str (ptid_t (inf->vfork_parent->pid)); target_terminal::ours_for_output (); @@ -1150,7 +1150,7 @@ follow_exec (ptid_t ptid, char *exec_file_target) update_breakpoints_after_exec (); /* What is this a.out's name? */ - process_ptid = pid_to_ptid (pid); + process_ptid = ptid_t (pid); printf_unfiltered (_("%s is executing new program: %s\n"), target_pid_to_str (process_ptid), exec_file_target); @@ -2268,7 +2268,7 @@ user_visible_resume_ptid (int step) { /* Resume all threads of the current process (and none of other processes). */ - resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + resume_ptid = ptid_t (ptid_get_pid (inferior_ptid)); } else { @@ -3621,7 +3621,7 @@ void prepare_for_detach (void) { struct inferior *inf = current_inferior (); - ptid_t pid_ptid = pid_to_ptid (inf->pid); + ptid_t pid_ptid = ptid_t (inf->pid); displaced_step_inferior_state *displaced = get_displaced_stepping_state (inf); @@ -4547,7 +4547,7 @@ stop_all_threads (void) { if (debug_infrun) { - ptid_t ptid = pid_to_ptid (ws.value.integer); + ptid_t ptid = ptid_t (ws.value.integer); fprintf_unfiltered (gdb_stdlog, "infrun: %s exited while " @@ -4904,7 +4904,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs) process as not-executing so that finish_thread_state marks them stopped (in the user's perspective) if/when we present the stop to the user. */ - mark_ptid = pid_to_ptid (ptid_get_pid (ecs->ptid)); + mark_ptid = ptid_t (ptid_get_pid (ecs->ptid)); } else mark_ptid = ecs->ptid; @@ -7887,7 +7887,7 @@ void print_exited_reason (struct ui_out *uiout, int exitstatus) { struct inferior *inf = current_inferior (); - const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid)); + const char *pidstr = target_pid_to_str (ptid_t (inf->pid)); annotate_exited (exitstatus); if (exitstatus) diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 72695bb..ef9015d 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -216,7 +216,7 @@ fork_id_to_ptid (int num) if (fork) return fork->ptid; else - return pid_to_ptid (-1); + return ptid_t (-1); } static void diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 4953615..f62910c 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1466,17 +1466,17 @@ linux_nat_target::detach (inferior *inf, int from_tty) /* Stop all threads before detaching. ptrace requires that the thread is stopped to sucessfully detach. */ - iterate_over_lwps (pid_to_ptid (pid), stop_callback, NULL); + iterate_over_lwps (ptid_t (pid), stop_callback, NULL); /* ... and wait until all of them have reported back that they're no longer running. */ - iterate_over_lwps (pid_to_ptid (pid), stop_wait_callback, NULL); + iterate_over_lwps (ptid_t (pid), stop_wait_callback, NULL); - iterate_over_lwps (pid_to_ptid (pid), detach_callback, NULL); + iterate_over_lwps (ptid_t (pid), detach_callback, NULL); /* Only the initial process should be left right now. */ gdb_assert (num_lwps (pid) == 1); - main_lwp = find_lwp_pid (pid_to_ptid (pid)); + main_lwp = find_lwp_pid (ptid_t (pid)); if (forks_exist_p ()) { @@ -2920,7 +2920,7 @@ linux_nat_filter_event (int lwpid, int status) struct lwp_info *lp; int event = linux_ptrace_get_extended_event (status); - lp = find_lwp_pid (pid_to_ptid (lwpid)); + lp = find_lwp_pid (ptid_t (lwpid)); /* Check for stop events reported by a process we didn't already know about - anything not already in our LWP list. @@ -3125,7 +3125,7 @@ linux_nat_filter_event (int lwpid, int status) will receive it - unless they're using CLONE_THREAD to share signals. Since we only want to report it once, we mark it as ignored for all LWPs except this one. */ - iterate_over_lwps (pid_to_ptid (ptid_get_pid (lp->ptid)), + iterate_over_lwps (ptid_t (ptid_get_pid (lp->ptid)), set_ignore_sigint, NULL); lp->ignore_sigint = 0; } @@ -3176,7 +3176,7 @@ check_zombie_leaders (void) if (inf->pid == 0) continue; - leader_lp = find_lwp_pid (pid_to_ptid (inf->pid)); + leader_lp = find_lwp_pid (ptid_t (inf->pid)); if (leader_lp != NULL /* Check if there are other threads in the group, as we may have raced with the inferior simply exiting. */ @@ -3713,7 +3713,7 @@ linux_nat_target::kill () linux_fork_killall (); else { - ptid_t ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid)); /* Stop all threads before killing them, since ptrace requires that the thread is stopped to sucessfully PTRACE_KILL. */ diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c index a3931ea..22b265e 100644 --- a/gdb/nat/aarch64-linux-hw-point.c +++ b/gdb/nat/aarch64-linux-hw-point.c @@ -357,7 +357,7 @@ aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state, int is_watchpoint, unsigned int idx) { struct aarch64_dr_update_callback_param param; - ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ())); + ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ())); param.is_watchpoint = is_watchpoint; param.idx = idx; diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c index 8b59387..ea71aad 100644 --- a/gdb/nat/fork-inferior.c +++ b/gdb/nat/fork-inferior.c @@ -484,7 +484,7 @@ startup_inferior (pid_t pid, int ntraps, } if (target_supports_multi_process ()) - resume_ptid = pid_to_ptid (pid); + resume_ptid = ptid_t (pid); else resume_ptid = minus_one_ptid; diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c index 74e481c..9865ac6 100644 --- a/gdb/nat/x86-linux-dregs.c +++ b/gdb/nat/x86-linux-dregs.c @@ -102,7 +102,7 @@ x86_linux_dr_get_addr (int regnum) void x86_linux_dr_set_addr (int regnum, CORE_ADDR addr) { - ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ())); + ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ())); gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR); @@ -122,7 +122,7 @@ x86_linux_dr_get_control (void) void x86_linux_dr_set_control (unsigned long control) { - ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ())); + ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ())); iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL); } diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index c1b38e8..7591a60 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -713,14 +713,14 @@ nto_procfs_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); else printf_unfiltered ("Attaching to %s\n", - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } - inferior_ptid = do_attach (pid_to_ptid (pid)); + inferior_ptid = do_attach (ptid_t (pid)); inf = current_inferior (); inferior_appeared (inf, pid); inf->attach_flag = 1; @@ -1311,7 +1311,7 @@ nto_procfs_target::create_inferior (const char *exec_file, if (fds[2] != STDERR_FILENO) close (fds[2]); - inferior_ptid = do_attach (pid_to_ptid (pid)); + inferior_ptid = do_attach (ptid_t (pid)); procfs_update_thread_list (ops); inf = current_inferior (); diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c index 08e873d..ac05fae 100644 --- a/gdb/obsd-nat.c +++ b/gdb/obsd-nat.c @@ -115,7 +115,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, } while (pid == -1); - ptid = pid_to_ptid (pid); + ptid = ptid_t (pid); if (WIFSTOPPED (status)) { @@ -129,7 +129,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, { case PTRACE_FORK: ourstatus->kind = TARGET_WAITKIND_FORKED; - ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); + ourstatus->value.related_pid = ptid_t (pe.pe_other_pid); /* Make sure the other end of the fork is stopped too. */ fpid = waitpid (pe.pe_other_pid, &status, 0); @@ -144,11 +144,11 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, gdb_assert (pe.pe_other_pid == pid); if (fpid == ptid_get_pid (inferior_ptid)) { - ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); - return pid_to_ptid (fpid); + ourstatus->value.related_pid = ptid_t (pe.pe_other_pid); + return ptid_t (fpid); } - return pid_to_ptid (pid); + return ptid_t (pid); } ptid = ptid_t (pid, pe.pe_tid, 0); diff --git a/gdb/procfs.c b/gdb/procfs.c index 35931e2..df23966 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1895,14 +1895,14 @@ procfs_target::attach (const char *args, int from_tty) if (exec_file) printf_filtered (_("Attaching to program `%s', %s\n"), - exec_file, target_pid_to_str (pid_to_ptid (pid))); + exec_file, target_pid_to_str (ptid_t (pid))); else printf_filtered (_("Attaching to %s\n"), - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); fflush (stdout); } - inferior_ptid = do_attach (pid_to_ptid (pid)); + inferior_ptid = do_attach (ptid_t (pid)); if (!target_is_pushed (this)) push_target (this); } @@ -1921,7 +1921,7 @@ procfs_target::detach (inferior *inf, int from_tty) exec_file = ""; printf_filtered (_("Detaching from program: %s, %s\n"), exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } @@ -2208,7 +2208,7 @@ wait_again: retry++; wstat = 0; - retval = pid_to_ptid (-1); + retval = ptid_t (-1); /* Find procinfo for main process. */ pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0); @@ -2244,7 +2244,7 @@ wait_again: ptid_get_pid (inferior_ptid), wait_retval); /* FIXME: might I not just use waitpid? Or try find_procinfo to see if I know about this child? */ - retval = pid_to_ptid (wait_retval); + retval = ptid_t (wait_retval); } else if (errno == EINTR) goto wait_again; @@ -2340,7 +2340,7 @@ wait_again: /* If wait returns -1, that's what we return to GDB. */ if (temp < 0) - retval = pid_to_ptid (temp); + retval = ptid_t (temp); } } else @@ -2507,7 +2507,7 @@ wait_again: case FLTPAGE: /* Recoverable page fault */ default: /* FIXME: use si_signo if possible for fault. */ - retval = pid_to_ptid (-1); + retval = ptid_t (-1); printf_filtered ("procfs:%d -- ", __LINE__); printf_filtered (_("child stopped for unknown reason:\n")); proc_prettyprint_why (why, what, 1); @@ -2959,7 +2959,7 @@ procfs_init_inferior (struct target_ops *ops, int pid) /* We already have a main thread registered in the thread table at this point, but it didn't have any lwp info yet. Notify the core about it. This changes inferior_ptid as well. */ - thread_change_ptid (pid_to_ptid (pid), + thread_change_ptid (ptid_t (pid), ptid_t (pid, lwpid, 0)); gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED); @@ -3126,7 +3126,7 @@ procfs_target::create_inferior (const char *exec_file, /* We have something that executes now. We'll be running through the shell at this point (if startup-with-shell is true), but the pid shouldn't change. */ - add_thread_silent (pid_to_ptid (pid)); + add_thread_silent (ptid_t (pid)); procfs_init_inferior (this, pid); } @@ -3749,7 +3749,7 @@ _initialize_procfs (void) ptid_t procfs_first_available (void) { - return pid_to_ptid (procinfo_list ? procinfo_list->pid : -1); + return ptid_t (procinfo_list ? procinfo_list->pid : -1); } /* =================== GCORE .NOTE "MODULE" =================== */ diff --git a/gdb/progspace.c b/gdb/progspace.c index ca6b02f..3507b92 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -293,12 +293,12 @@ print_program_space (struct ui_out *uiout, int requested) printed_header = 1; printf_filtered ("\n\tBound inferiors: ID %d (%s)", inf->num, - target_pid_to_str (pid_to_ptid (inf->pid))); + target_pid_to_str (ptid_t (inf->pid))); } else printf_filtered (", ID %d (%s)", inf->num, - target_pid_to_str (pid_to_ptid (inf->pid))); + target_pid_to_str (ptid_t (inf->pid))); } uiout->text ("\n"); diff --git a/gdb/remote.c b/gdb/remote.c index 31118d2..40080b5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2443,7 +2443,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing) stub doesn't support qC. This is the first stop reported after an attach, so this is the main thread. Update the ptid in the thread list. */ - if (in_thread_list (pid_to_ptid (pid))) + if (in_thread_list (ptid_t (pid))) thread_change_ptid (inferior_ptid, currthread); else { @@ -5682,7 +5682,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty) { /* Save the pid as a string before mourning, since that will unpush the remote target, and we need the string after. */ - std::string infpid = target_pid_to_str (pid_to_ptid (pid)); + std::string infpid = target_pid_to_str (ptid_t (pid)); target_mourn_inferior (inferior_ptid); if (print_inferior_events) @@ -5804,10 +5804,10 @@ extended_remote_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); else printf_unfiltered (_("Attaching to %s\n"), - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } @@ -5828,19 +5828,19 @@ extended_remote_target::attach (const char *args, int from_tty) } else if (strcmp (rs->buf, "OK") != 0) error (_("Attaching to %s failed with: %s"), - target_pid_to_str (pid_to_ptid (pid)), + target_pid_to_str (ptid_t (pid)), rs->buf); break; case PACKET_UNKNOWN: error (_("This target does not support attaching to a process")); default: error (_("Attaching to %s failed"), - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); } set_current_inferior (remote_add_inferior (0, pid, 1, 0)); - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); if (target_is_non_stop_p ()) { @@ -5853,7 +5853,7 @@ extended_remote_target::attach (const char *args, int from_tty) if (thread) inferior_ptid = thread->ptid; else - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); /* Invalidate our notion of the remote current thread. */ record_currthread (rs, minus_one_ptid); @@ -6575,7 +6575,7 @@ remote_target::commit_resume () { if (get_remote_inferior (inf)->may_wildcard_vcont) { - vcont_builder.push_action (pid_to_ptid (inf->pid), + vcont_builder.push_action (ptid_t (inf->pid), false, GDB_SIGNAL_0); } } @@ -7530,7 +7530,7 @@ Packet: '%s'\n"), } else error (_("unknown stop reply packet: %s"), buf); - event->ptid = pid_to_ptid (pid); + event->ptid = ptid_t (pid); } break; case 'N': diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 31677c2..8a9a0ed 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -543,7 +543,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, else store_waitstatus (ourstatus, status); - return pid_to_ptid (pid); + return ptid_t (pid); } diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 8d3ed55..74cab71 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -848,7 +848,7 @@ s390_refresh_per_info_cb (struct lwp_info *lp, void *arg) static int s390_refresh_per_info (void) { - ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ())); + ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ())); iterate_over_lwps (pid_ptid, s390_refresh_per_info_cb, NULL); return 0; diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index d67fd83..85d3ad9 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -307,20 +307,20 @@ thread_to_lwp (ptid_t thread_id, int default_lwp) val = p_td_ta_map_id2thr (main_ta, ptid_get_tid (thread_id), &th); if (val == TD_NOTHR) - return pid_to_ptid (-1); /* Thread must have terminated. */ + return ptid_t (-1); /* Thread must have terminated. */ else if (val != TD_OK) error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val)); val = p_td_thr_get_info (&th, &ti); if (val == TD_NOTHR) - return pid_to_ptid (-1); /* Thread must have terminated. */ + return ptid_t (-1); /* Thread must have terminated. */ else if (val != TD_OK) error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val)); if (ti.ti_state != TD_THR_ACTIVE) { if (default_lwp != -1) - return pid_to_ptid (default_lwp); + return ptid_t (default_lwp); error (_("thread_to_lwp: thread state not active: %s"), td_state_string (ti.ti_state)); } @@ -346,11 +346,11 @@ lwp_to_thread (ptid_t lwp) /* It's an LWP. Convert it to a thread ID. */ if (!target_thread_alive (lwp)) - return pid_to_ptid (-1); /* Must be a defunct LPW. */ + return ptid_t (-1); /* Must be a defunct LPW. */ val = p_td_ta_map_lwp2thr (main_ta, ptid_get_lwp (lwp), &th); if (val == TD_NOTHR) - return pid_to_ptid (-1); /* Thread must have terminated. */ + return ptid_t (-1); /* Thread must have terminated. */ else if (val != TD_OK) error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val)); @@ -362,7 +362,7 @@ lwp_to_thread (ptid_t lwp) val = p_td_thr_get_info (&th, &ti); if (val == TD_NOTHR) - return pid_to_ptid (-1); /* Thread must have terminated. */ + return ptid_t (-1); /* Thread must have terminated. */ else if (val != TD_OK) error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val)); @@ -387,7 +387,7 @@ sol_thread_target::detach (inferior *inf, int from_tty) target_ops *beneath = this->beneath (); sol_thread_active = 0; - inferior_ptid = pid_to_ptid (ptid_get_pid (main_ph.ptid)); + inferior_ptid = ptid_t (ptid_get_pid (main_ph.ptid)); unpush_target (this); beneath->detach (inf, from_tty); } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 96cda72..18c1856 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -503,7 +503,7 @@ spu_linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, } store_waitstatus (ourstatus, status); - return pid_to_ptid (pid); + return ptid_t (pid); } /* Override the fetch_inferior_register routine. */ diff --git a/gdb/target.c b/gdb/target.c index 909d181..5f8fdc6 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3242,7 +3242,7 @@ target_announce_detach (int from_tty) pid = ptid_get_pid (inferior_ptid); printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } @@ -1542,11 +1542,11 @@ print_inferior_quit_action (struct inferior *inf, void *arg) if (inf->attach_flag) fprintf_filtered (stb, _("\tInferior %d [%s] will be detached.\n"), inf->num, - target_pid_to_str (pid_to_ptid (inf->pid))); + target_pid_to_str (ptid_t (inf->pid))); else fprintf_filtered (stb, _("\tInferior %d [%s] will be killed.\n"), inf->num, - target_pid_to_str (pid_to_ptid (inf->pid))); + target_pid_to_str (ptid_t (inf->pid))); return 0; } diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 0dd9d5f..6996e3d 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -555,7 +555,7 @@ tfile_target_open (const char *arg, int from_tty) END_CATCH inferior_appeared (current_inferior (), TFILE_PID); - inferior_ptid = pid_to_ptid (TFILE_PID); + inferior_ptid = ptid_t (TFILE_PID); add_thread_silent (inferior_ptid); if (ts->traceframe_count <= 0) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 0453ce3..1e4c770 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1845,7 +1845,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) can rely on it. When attaching, we don't know about any thread id here, but that's OK --- nothing should be referencing the current thread until we report an event out of windows_wait. */ - inferior_ptid = pid_to_ptid (pid); + inferior_ptid = ptid_t (pid); target_terminal::init (); target_terminal::inferior (); @@ -1980,10 +1980,10 @@ windows_nat_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); else printf_unfiltered ("Attaching to %s\n", - target_pid_to_str (pid_to_ptid (pid))); + target_pid_to_str (ptid_t (pid))); gdb_flush (gdb_stdout); } |