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.
This commit is contained in:
Tom Tromey 2018-06-11 11:25:49 -06:00
parent fd79271bd9
commit f2907e4991
43 changed files with 176 additions and 139 deletions

View File

@ -1,3 +1,41 @@
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> 2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.h (ptid_build): Don't declare. * common/ptid.h (ptid_build): Don't declare.

View File

@ -325,7 +325,7 @@ pid_to_prc (ptid_t *ptidp)
ptid = *ptidp; ptid = *ptidp;
if (PD_TID (ptid)) 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 /* 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); 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); beneath ()->resume (ptid, step, sig);
} }
else else
@ -1082,12 +1082,12 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
pid_to_prc (&ptid); 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); ptid = beneath ()->wait (ptid, status, options);
} }
if (ptid_get_pid (ptid) == -1) if (ptid_get_pid (ptid) == -1)
return pid_to_ptid (-1); return ptid_t (-1);
/* Check whether libpthdebug might be ready to be initialized. */ /* Check whether libpthdebug might be ready to be initialized. */
if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED 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); 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, return beneath ()->xfer_partial (object, annex, readbuf,
writebuf, offset, len, xfered_len); writebuf, offset, len, xfered_len);
} }

View File

@ -994,7 +994,7 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
struct update_registers_data data; struct update_registers_data data;
pid = ptid_get_pid (inferior_ptid); pid = ptid_get_pid (inferior_ptid);
pid_ptid = pid_to_ptid (pid); pid_ptid = ptid_t (pid);
if (watchpoint) if (watchpoint)
{ {
@ -1033,7 +1033,7 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
struct update_registers_data data; struct update_registers_data data;
pid = ptid_get_pid (inferior_ptid); pid = ptid_get_pid (inferior_ptid);
pid_ptid = pid_to_ptid (pid); pid_ptid = ptid_t (pid);
if (watchpoint) if (watchpoint)
{ {

View File

@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
/* See ptid.h. */ /* See ptid.h. */
ptid_t
pid_to_ptid (int pid)
{
return ptid_t (pid);
}
/* See ptid.h. */
int int
ptid_get_pid (const ptid_t &ptid) ptid_get_pid (const ptid_t &ptid)
{ {

View File

@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
/* The following functions are kept for backwards compatibility. The use of /* The following functions are kept for backwards compatibility. The use of
the ptid_t methods is preferred. */ the ptid_t methods is preferred. */
/* See ptid_t::ptid_t. */
extern ptid_t pid_to_ptid (int pid);
/* See ptid_t::pid. */ /* See ptid_t::pid. */
extern int ptid_get_pid (const ptid_t &ptid); extern int ptid_get_pid (const ptid_t &ptid);

View File

@ -457,7 +457,7 @@ core_target_open (const char *arg, int from_tty)
if (thread == NULL) if (thread == NULL)
{ {
inferior_appeared (current_inferior (), CORELOW_PID); inferior_appeared (current_inferior (), CORELOW_PID);
inferior_ptid = pid_to_ptid (CORELOW_PID); inferior_ptid = ptid_t (CORELOW_PID);
add_thread_silent (inferior_ptid); add_thread_silent (inferior_ptid);
} }
else else
@ -1007,7 +1007,7 @@ core_target::pid_to_str (ptid_t ptid)
/* Try the LWPID field first. */ /* Try the LWPID field first. */
pid = ptid_get_lwp (ptid); pid = ptid_get_lwp (ptid);
if (pid != 0) 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 /* Otherwise, this isn't a "threaded" core -- use the PID field, but
only if it isn't a fake PID. */ only if it isn't a fake PID. */

View File

@ -1160,7 +1160,7 @@ ctf_target_open (const char *dirname, int from_tty)
push_target (&ctf_ops); push_target (&ctf_ops);
inferior_appeared (current_inferior (), CTF_PID); inferior_appeared (current_inferior (), CTF_PID);
inferior_ptid = pid_to_ptid (CTF_PID); inferior_ptid = ptid_t (CTF_PID);
add_thread_silent (inferior_ptid); add_thread_silent (inferior_ptid);
merge_uploaded_trace_state_variables (&uploaded_tsvs); merge_uploaded_trace_state_variables (&uploaded_tsvs);

View File

@ -1881,10 +1881,10 @@ darwin_nat_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_unfiltered (_("Attaching to program: %s, %s\n"), 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 else
printf_unfiltered (_("Attaching to %s\n"), 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); 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)"), error (_("Can't attach to process %d: %s (%d)"),
pid, safe_strerror (errno), errno); pid, safe_strerror (errno), errno);
inferior_ptid = pid_to_ptid (pid); inferior_ptid = ptid_t (pid);
inf = current_inferior (); inf = current_inferior ();
inferior_appeared (inf, pid); inferior_appeared (inf, pid);
inf->attach_flag = 1; inf->attach_flag = 1;

View File

@ -926,7 +926,7 @@ fbsd_add_threads (pid_t pid)
{ {
int i, nlwps; 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); nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0);
if (nlwps == -1) if (nlwps == -1)
perror_with_name (("ptrace")); 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 PL_FLAG_BORN in case the first stop reported after
attaching to an existing process is a PL_FLAG_BORN attaching to an existing process is a PL_FLAG_BORN
event. */ event. */
if (in_thread_list (pid_to_ptid (pid))) if (in_thread_list (ptid_t (pid)))
{ {
if (debug_fbsd_lwp) if (debug_fbsd_lwp)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"FLWP: using LWP %u for first thread\n", "FLWP: using LWP %u for first thread\n",
pl.pl_lwpid); pl.pl_lwpid);
thread_change_ptid (pid_to_ptid (pid), wptid); thread_change_ptid (ptid_t (pid), wptid);
} }
#ifdef PT_LWP_EVENTS #ifdef PT_LWP_EVENTS

View File

@ -88,7 +88,7 @@ postfork_hook (pid_t pid)
inferior_appeared (inf, pid); inferior_appeared (inf, pid);
/* Needed for wait_for_inferior stuff. */ /* Needed for wait_for_inferior stuff. */
inferior_ptid = pid_to_ptid (pid); inferior_ptid = ptid_t (pid);
gdb_assert (saved_ui != NULL); gdb_assert (saved_ui != NULL);
current_ui = saved_ui; current_ui = saved_ui;

View File

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

View File

@ -1226,13 +1226,13 @@ linux_attach (unsigned long pid)
{ {
struct lwp_info *lwp; struct lwp_info *lwp;
int wstat, lwpid; 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, lwpid = linux_wait_for_event_filtered (pid_ptid, pid_ptid,
&wstat, __WALL); &wstat, __WALL);
gdb_assert (lwpid > 0); 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) 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 /* See the comment in linux_kill_one_lwp. We did not kill the first
thread in the list, so do so now. */ 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) if (lwp == NULL)
{ {
@ -1640,7 +1640,7 @@ linux_detach (int pid)
able to reap the leader. */ able to reap the leader. */
for_each_thread (pid, linux_detach_lwp_callback); 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); linux_detach_one_lwp (main_lwp);
the_target->mourn (process); the_target->mourn (process);
@ -1878,7 +1878,7 @@ check_zombie_leaders (void)
pid_t leader_pid = pid_of (proc); pid_t leader_pid = pid_of (proc);
struct lwp_info *leader_lp; 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) if (debug_threads)
debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, " 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; struct thread_info *thread;
int have_stop_pc = 0; 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 /* Check for stop events reported by a process we didn't already
know about - anything not already in our LWP list. know about - anything not already in our LWP list.

View File

@ -703,7 +703,7 @@ ppc_supports_tracepoints (void)
static int static int
ppc_get_thread_area (int lwpid, CORE_ADDR *addr) 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 thread_info *thr = get_lwp_thread (lwp);
struct regcache *regcache = get_thread_regcache (thr, 1); struct regcache *regcache = get_thread_regcache (thr, 1);
ULONGEST tp = 0; ULONGEST tp = 0;

View File

@ -255,7 +255,7 @@ x86_get_thread_area (int lwpid, CORE_ADDR *addr)
#endif #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 thread_info *thr = get_lwp_thread (lwp);
struct regcache *regcache = get_thread_regcache (thr, 1); struct regcache *regcache = get_thread_regcache (thr, 1);
unsigned int desc[4]; unsigned int desc[4];

View File

@ -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 thread_info *reg_thread, *saved_thread;
struct regcache *regcache; struct regcache *regcache;
lwp = find_lwp_pid (pid_to_ptid (lwpid)); lwp = find_lwp_pid (ptid_t (lwpid));
if (lwp == NULL) if (lwp == NULL)
return PS_ERR; return PS_ERR;

View File

@ -308,7 +308,7 @@ attach_inferior (int pid)
if (!non_stop) 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 /* GDB knows to ignore the first SIGSTOP after attaching to a running
process using the "attach" command, but this is different; it's process using the "attach" command, but this is different; it's
@ -1256,7 +1256,7 @@ handle_detach (char *own_buf)
write_enn (own_buf); write_enn (own_buf);
else else
{ {
discard_queued_stop_replies (pid_to_ptid (pid)); discard_queued_stop_replies (ptid_t (pid));
write_ok (own_buf); write_ok (own_buf);
if (extended_protocol || target_running ()) if (extended_protocol || target_running ())
@ -1266,7 +1266,7 @@ handle_detach (char *own_buf)
and instead treat this like a normal program exit. */ and instead treat this like a normal program exit. */
cs.last_status.kind = TARGET_WAITKIND_EXITED; cs.last_status.kind = TARGET_WAITKIND_EXITED;
cs.last_status.value.integer = 0; cs.last_status.value.integer = 0;
cs.last_ptid = pid_to_ptid (pid); cs.last_ptid = ptid_t (pid);
current_thread = NULL; current_thread = NULL;
} }
@ -3081,7 +3081,7 @@ handle_v_kill (char *own_buf)
{ {
cs.last_status.kind = TARGET_WAITKIND_SIGNALLED; cs.last_status.kind = TARGET_WAITKIND_SIGNALLED;
cs.last_status.value.sig = GDB_SIGNAL_KILL; 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); discard_queued_stop_replies (cs.last_ptid);
write_ok (own_buf); write_ok (own_buf);
return 1; return 1;
@ -3481,7 +3481,7 @@ kill_inferior_callback (process_info *process)
int pid = process->pid; int pid = process->pid;
kill_inferior (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 /* Call this when exiting gdbserver with possible inferiors that need
@ -3527,7 +3527,7 @@ detach_or_kill_for_exit (void)
else else
kill_inferior (pid); kill_inferior (pid);
discard_queued_stop_replies (pid_to_ptid (pid)); discard_queued_stop_replies (ptid_t (pid));
}); });
} }

View File

@ -457,7 +457,7 @@ spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
ourstatus->kind = TARGET_WAITKIND_EXITED; ourstatus->kind = TARGET_WAITKIND_EXITED;
ourstatus->value.integer = WEXITSTATUS (w); ourstatus->value.integer = WEXITSTATUS (w);
clear_inferiors (); clear_inferiors ();
return pid_to_ptid (ret); return ptid_t (ret);
} }
else if (!WIFSTOPPED (w)) 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->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w)); ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w));
clear_inferiors (); clear_inferiors ();
return pid_to_ptid (ret); return ptid_t (ret);
} }
/* After attach, we may have received a SIGSTOP. Do not return this /* After attach, we may have received a SIGSTOP. Do not return this

View File

@ -252,7 +252,7 @@ maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p,
{ {
struct lwp_info *lwp; 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) if (lwp != NULL)
return 1; return 1;

View File

@ -707,7 +707,7 @@ win32_create_inferior (const char *program,
/* Wait till we are at 1st instruction in program, return new pid /* Wait till we are at 1st instruction in program, return new pid
(assuming success). */ (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; 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", OUTMSG2 (("Child exited with retcode = %x\n",
ourstatus->value.integer)); ourstatus->value.integer));
win32_clear_inferiors (); win32_clear_inferiors ();
return pid_to_ptid (current_event.dwProcessId); return ptid_t (current_event.dwProcessId);
case TARGET_WAITKIND_STOPPED: case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_LOADED: case TARGET_WAITKIND_LOADED:
OUTMSG2 (("Child Stopped with signal = %d \n", OUTMSG2 (("Child Stopped with signal = %d \n",

View File

@ -1100,7 +1100,7 @@ inf_validate_procs (struct inf *inf)
/* Tell GDB's generic thread code. */ /* 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 /* This is the first time we're hearing about thread
ids, after a fork-child. */ ids, after a fork-child. */
thread_change_ptid (inferior_ptid, ptid); 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 /* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the the shell at this point (if startup-with-shell is true), but the
pid shouldn't change. */ 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... */ /* Attach to the now stopped child, which is actually a shell... */
inf_debug (inf, "attaching to child: %d", pid); inf_debug (inf, "attaching to child: %d", pid);

View File

@ -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 static void
@ -752,7 +752,7 @@ go32_nat_target::create_inferior (const char *exec_file,
save_npx (); save_npx ();
#endif #endif
inferior_ptid = pid_to_ptid (SOME_PID); inferior_ptid = ptid_t (SOME_PID);
inf = current_inferior (); inf = current_inferior ();
inferior_appeared (inf, SOME_PID); inferior_appeared (inf, SOME_PID);

View File

@ -131,7 +131,7 @@ inf_ptrace_target::create_inferior (const char *exec_file,
pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL, pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
ptid = pid_to_ptid (pid); ptid = ptid_t (pid);
/* We have something that executes now. We'll be running through /* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the the shell at this point (if startup-with-shell is true), but the
pid shouldn't change. */ pid shouldn't change. */
@ -213,10 +213,10 @@ inf_ptrace_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_unfiltered (_("Attaching to program: %s, %s\n"), 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 else
printf_unfiltered (_("Attaching to %s\n"), 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); gdb_flush (gdb_stdout);
} }
@ -233,7 +233,7 @@ inf_ptrace_target::attach (const char *args, int from_tty)
inf = current_inferior (); inf = current_inferior ();
inferior_appeared (inf, pid); inferior_appeared (inf, pid);
inf->attach_flag = 1; 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 /* Always add a main thread. If some target extends the ptrace
target, it should decorate the ptid later with more info. */ 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: case PTRACE_FORK:
ourstatus->kind = TARGET_WAITKIND_FORKED; 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. */ /* Make sure the other end of the fork is stopped too. */
fpid = waitpid (pe.pe_other_pid, &status, 0); 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); gdb_assert (pe.pe_other_pid == pid);
if (fpid == ptid_get_pid (inferior_ptid)) if (fpid == ptid_get_pid (inferior_ptid))
{ {
ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
return pid_to_ptid (fpid); return ptid_t (fpid);
} }
return pid_to_ptid (pid); return ptid_t (pid);
} }
} }
#endif #endif
store_waitstatus (ourstatus, status); 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 /* Transfer data via ptrace into process PID's memory from WRITEBUF, or

View File

@ -2600,7 +2600,7 @@ kill_command (const char *arg, int from_tty)
int pid = current_inferior ()->pid; int pid = current_inferior ()->pid;
/* Save the pid as a string before killing the inferior, since that /* Save the pid as a string before killing the inferior, since that
may unpush the current target, and we need the string after. */ 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; int infnum = current_inferior ()->num;
target_kill (); 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 Be sure to explicitly stop all threads of the process. This
should have no effect on already stopped threads. */ should have no effect on already stopped threads. */
if (non_stop) if (non_stop)
target_stop (pid_to_ptid (inferior->pid)); target_stop (ptid_t (inferior->pid));
else if (target_is_non_stop_p ()) else if (target_is_non_stop_p ())
{ {
struct thread_info *thread; struct thread_info *thread;
@ -2897,7 +2897,7 @@ attach_command (const char *args, int from_tty)
else else
/* The user requested an `attach', so stop all threads of this /* The user requested an `attach', so stop all threads of this
inferior. */ 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; mode = async_exec ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_STOP;

View File

@ -124,7 +124,7 @@ add_inferior (int pid)
if (print_inferior_events) if (print_inferior_events)
printf_unfiltered (_("[New inferior %d (%s)]\n"), printf_unfiltered (_("[New inferior %d (%s)]\n"),
inf->num, inf->num,
target_pid_to_str (pid_to_ptid (pid))); target_pid_to_str (ptid_t (pid)));
return inf; return inf;
} }
@ -263,7 +263,7 @@ detach_inferior (inferior *inf)
if (print_inferior_events) if (print_inferior_events)
printf_unfiltered (_("[Inferior %d (%s) detached]\n"), printf_unfiltered (_("[Inferior %d (%s) detached]\n"),
inf->num, inf->num,
target_pid_to_str (pid_to_ptid (pid))); target_pid_to_str (ptid_t (pid)));
} }
void void
@ -457,7 +457,7 @@ static const char *
inferior_pid_to_str (int pid) inferior_pid_to_str (int pid)
{ {
if (pid != 0) if (pid != 0)
return target_pid_to_str (pid_to_ptid (pid)); return target_pid_to_str (ptid_t (pid));
else else
return _("<null>"); return _("<null>");
} }

View File

@ -462,7 +462,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
if (print_inferior_events) if (print_inferior_events)
{ {
/* Ensure that we have a process ptid. */ /* 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 (); target_terminal::ours_for_output ();
fprintf_filtered (gdb_stdlog, fprintf_filtered (gdb_stdlog,
@ -598,7 +598,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
if (print_inferior_events) if (print_inferior_events)
{ {
/* Ensure that we have a process ptid. */ /* 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 (); target_terminal::ours_for_output ();
fprintf_filtered (gdb_stdlog, fprintf_filtered (gdb_stdlog,
@ -961,7 +961,7 @@ handle_vfork_child_exec_or_exit (int exec)
if (print_inferior_events) if (print_inferior_events)
{ {
const char *pidstr 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 (); target_terminal::ours_for_output ();
@ -1150,7 +1150,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
update_breakpoints_after_exec (); update_breakpoints_after_exec ();
/* What is this a.out's name? */ /* 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"), printf_unfiltered (_("%s is executing new program: %s\n"),
target_pid_to_str (process_ptid), target_pid_to_str (process_ptid),
exec_file_target); exec_file_target);
@ -2268,7 +2268,7 @@ user_visible_resume_ptid (int step)
{ {
/* Resume all threads of the current process (and none of other /* Resume all threads of the current process (and none of other
processes). */ processes). */
resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); resume_ptid = ptid_t (ptid_get_pid (inferior_ptid));
} }
else else
{ {
@ -3621,7 +3621,7 @@ void
prepare_for_detach (void) prepare_for_detach (void)
{ {
struct inferior *inf = current_inferior (); 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); displaced_step_inferior_state *displaced = get_displaced_stepping_state (inf);
@ -4547,7 +4547,7 @@ stop_all_threads (void)
{ {
if (debug_infrun) if (debug_infrun)
{ {
ptid_t ptid = pid_to_ptid (ws.value.integer); ptid_t ptid = ptid_t (ws.value.integer);
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"infrun: %s exited while " "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 process as not-executing so that finish_thread_state marks
them stopped (in the user's perspective) if/when we present them stopped (in the user's perspective) if/when we present
the stop to the user. */ 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 else
mark_ptid = ecs->ptid; mark_ptid = ecs->ptid;
@ -7887,7 +7887,7 @@ void
print_exited_reason (struct ui_out *uiout, int exitstatus) print_exited_reason (struct ui_out *uiout, int exitstatus)
{ {
struct inferior *inf = current_inferior (); 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); annotate_exited (exitstatus);
if (exitstatus) if (exitstatus)

View File

@ -216,7 +216,7 @@ fork_id_to_ptid (int num)
if (fork) if (fork)
return fork->ptid; return fork->ptid;
else else
return pid_to_ptid (-1); return ptid_t (-1);
} }
static void static void

View File

@ -1466,17 +1466,17 @@ linux_nat_target::detach (inferior *inf, int from_tty)
/* Stop all threads before detaching. ptrace requires that the /* Stop all threads before detaching. ptrace requires that the
thread is stopped to sucessfully detach. */ 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 /* ... and wait until all of them have reported back that
they're no longer running. */ 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. */ /* Only the initial process should be left right now. */
gdb_assert (num_lwps (pid) == 1); 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 ()) if (forks_exist_p ())
{ {
@ -2920,7 +2920,7 @@ linux_nat_filter_event (int lwpid, int status)
struct lwp_info *lp; struct lwp_info *lp;
int event = linux_ptrace_get_extended_event (status); 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 /* Check for stop events reported by a process we didn't already
know about - anything not already in our LWP list. 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 will receive it - unless they're using CLONE_THREAD to
share signals. Since we only want to report it once, we share signals. Since we only want to report it once, we
mark it as ignored for all LWPs except this one. */ 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); set_ignore_sigint, NULL);
lp->ignore_sigint = 0; lp->ignore_sigint = 0;
} }
@ -3176,7 +3176,7 @@ check_zombie_leaders (void)
if (inf->pid == 0) if (inf->pid == 0)
continue; continue;
leader_lp = find_lwp_pid (pid_to_ptid (inf->pid)); leader_lp = find_lwp_pid (ptid_t (inf->pid));
if (leader_lp != NULL if (leader_lp != NULL
/* Check if there are other threads in the group, as we may /* Check if there are other threads in the group, as we may
have raced with the inferior simply exiting. */ have raced with the inferior simply exiting. */
@ -3713,7 +3713,7 @@ linux_nat_target::kill ()
linux_fork_killall (); linux_fork_killall ();
else 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 /* Stop all threads before killing them, since ptrace requires
that the thread is stopped to sucessfully PTRACE_KILL. */ that the thread is stopped to sucessfully PTRACE_KILL. */

View File

@ -357,7 +357,7 @@ aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
int is_watchpoint, unsigned int idx) int is_watchpoint, unsigned int idx)
{ {
struct aarch64_dr_update_callback_param param; 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.is_watchpoint = is_watchpoint;
param.idx = idx; param.idx = idx;

View File

@ -484,7 +484,7 @@ startup_inferior (pid_t pid, int ntraps,
} }
if (target_supports_multi_process ()) if (target_supports_multi_process ())
resume_ptid = pid_to_ptid (pid); resume_ptid = ptid_t (pid);
else else
resume_ptid = minus_one_ptid; resume_ptid = minus_one_ptid;

View File

@ -102,7 +102,7 @@ x86_linux_dr_get_addr (int regnum)
void void
x86_linux_dr_set_addr (int regnum, CORE_ADDR addr) 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); gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
@ -122,7 +122,7 @@ x86_linux_dr_get_control (void)
void void
x86_linux_dr_set_control (unsigned long control) 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); iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
} }

View File

@ -713,14 +713,14 @@ nto_procfs_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_unfiltered ("Attaching to program `%s', %s\n", 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 else
printf_unfiltered ("Attaching to %s\n", 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); gdb_flush (gdb_stdout);
} }
inferior_ptid = do_attach (pid_to_ptid (pid)); inferior_ptid = do_attach (ptid_t (pid));
inf = current_inferior (); inf = current_inferior ();
inferior_appeared (inf, pid); inferior_appeared (inf, pid);
inf->attach_flag = 1; inf->attach_flag = 1;
@ -1311,7 +1311,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
if (fds[2] != STDERR_FILENO) if (fds[2] != STDERR_FILENO)
close (fds[2]); close (fds[2]);
inferior_ptid = do_attach (pid_to_ptid (pid)); inferior_ptid = do_attach (ptid_t (pid));
procfs_update_thread_list (ops); procfs_update_thread_list (ops);
inf = current_inferior (); inf = current_inferior ();

View File

@ -115,7 +115,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
} }
while (pid == -1); while (pid == -1);
ptid = pid_to_ptid (pid); ptid = ptid_t (pid);
if (WIFSTOPPED (status)) if (WIFSTOPPED (status))
{ {
@ -129,7 +129,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
{ {
case PTRACE_FORK: case PTRACE_FORK:
ourstatus->kind = TARGET_WAITKIND_FORKED; 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. */ /* Make sure the other end of the fork is stopped too. */
fpid = waitpid (pe.pe_other_pid, &status, 0); 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); gdb_assert (pe.pe_other_pid == pid);
if (fpid == ptid_get_pid (inferior_ptid)) if (fpid == ptid_get_pid (inferior_ptid))
{ {
ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid); ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
return pid_to_ptid (fpid); return ptid_t (fpid);
} }
return pid_to_ptid (pid); return ptid_t (pid);
} }
ptid = ptid_t (pid, pe.pe_tid, 0); ptid = ptid_t (pid, pe.pe_tid, 0);

View File

@ -1895,14 +1895,14 @@ procfs_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_filtered (_("Attaching to program `%s', %s\n"), 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 else
printf_filtered (_("Attaching to %s\n"), printf_filtered (_("Attaching to %s\n"),
target_pid_to_str (pid_to_ptid (pid))); target_pid_to_str (ptid_t (pid)));
fflush (stdout); fflush (stdout);
} }
inferior_ptid = do_attach (pid_to_ptid (pid)); inferior_ptid = do_attach (ptid_t (pid));
if (!target_is_pushed (this)) if (!target_is_pushed (this))
push_target (this); push_target (this);
} }
@ -1921,7 +1921,7 @@ procfs_target::detach (inferior *inf, int from_tty)
exec_file = ""; exec_file = "";
printf_filtered (_("Detaching from program: %s, %s\n"), 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); gdb_flush (gdb_stdout);
} }
@ -2208,7 +2208,7 @@ wait_again:
retry++; retry++;
wstat = 0; wstat = 0;
retval = pid_to_ptid (-1); retval = ptid_t (-1);
/* Find procinfo for main process. */ /* Find procinfo for main process. */
pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0); pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
@ -2244,7 +2244,7 @@ wait_again:
ptid_get_pid (inferior_ptid), wait_retval); ptid_get_pid (inferior_ptid), wait_retval);
/* FIXME: might I not just use waitpid? /* FIXME: might I not just use waitpid?
Or try find_procinfo to see if I know about this child? */ 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) else if (errno == EINTR)
goto wait_again; goto wait_again;
@ -2340,7 +2340,7 @@ wait_again:
/* If wait returns -1, that's what we return /* If wait returns -1, that's what we return
to GDB. */ to GDB. */
if (temp < 0) if (temp < 0)
retval = pid_to_ptid (temp); retval = ptid_t (temp);
} }
} }
else else
@ -2507,7 +2507,7 @@ wait_again:
case FLTPAGE: /* Recoverable page fault */ case FLTPAGE: /* Recoverable page fault */
default: /* FIXME: use si_signo if possible for default: /* FIXME: use si_signo if possible for
fault. */ fault. */
retval = pid_to_ptid (-1); retval = ptid_t (-1);
printf_filtered ("procfs:%d -- ", __LINE__); printf_filtered ("procfs:%d -- ", __LINE__);
printf_filtered (_("child stopped for unknown reason:\n")); printf_filtered (_("child stopped for unknown reason:\n"));
proc_prettyprint_why (why, what, 1); 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 /* 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 this point, but it didn't have any lwp info yet. Notify the core
about it. This changes inferior_ptid as well. */ 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)); ptid_t (pid, lwpid, 0));
gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED); 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 /* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the the shell at this point (if startup-with-shell is true), but the
pid shouldn't change. */ pid shouldn't change. */
add_thread_silent (pid_to_ptid (pid)); add_thread_silent (ptid_t (pid));
procfs_init_inferior (this, pid); procfs_init_inferior (this, pid);
} }
@ -3749,7 +3749,7 @@ _initialize_procfs (void)
ptid_t ptid_t
procfs_first_available (void) 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" =================== */ /* =================== GCORE .NOTE "MODULE" =================== */

View File

@ -293,12 +293,12 @@ print_program_space (struct ui_out *uiout, int requested)
printed_header = 1; printed_header = 1;
printf_filtered ("\n\tBound inferiors: ID %d (%s)", printf_filtered ("\n\tBound inferiors: ID %d (%s)",
inf->num, inf->num,
target_pid_to_str (pid_to_ptid (inf->pid))); target_pid_to_str (ptid_t (inf->pid)));
} }
else else
printf_filtered (", ID %d (%s)", printf_filtered (", ID %d (%s)",
inf->num, inf->num,
target_pid_to_str (pid_to_ptid (inf->pid))); target_pid_to_str (ptid_t (inf->pid)));
} }
uiout->text ("\n"); uiout->text ("\n");

View File

@ -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 stub doesn't support qC. This is the first stop reported
after an attach, so this is the main thread. Update the after an attach, so this is the main thread. Update the
ptid in the thread list. */ 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); thread_change_ptid (inferior_ptid, currthread);
else 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 /* Save the pid as a string before mourning, since that will
unpush the remote target, and we need the string after. */ 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); target_mourn_inferior (inferior_ptid);
if (print_inferior_events) if (print_inferior_events)
@ -5804,10 +5804,10 @@ extended_remote_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_unfiltered (_("Attaching to program: %s, %s\n"), 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 else
printf_unfiltered (_("Attaching to %s\n"), 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); 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) else if (strcmp (rs->buf, "OK") != 0)
error (_("Attaching to %s failed with: %s"), error (_("Attaching to %s failed with: %s"),
target_pid_to_str (pid_to_ptid (pid)), target_pid_to_str (ptid_t (pid)),
rs->buf); rs->buf);
break; break;
case PACKET_UNKNOWN: case PACKET_UNKNOWN:
error (_("This target does not support attaching to a process")); error (_("This target does not support attaching to a process"));
default: default:
error (_("Attaching to %s failed"), 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)); 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 ()) if (target_is_non_stop_p ())
{ {
@ -5853,7 +5853,7 @@ extended_remote_target::attach (const char *args, int from_tty)
if (thread) if (thread)
inferior_ptid = thread->ptid; inferior_ptid = thread->ptid;
else else
inferior_ptid = pid_to_ptid (pid); inferior_ptid = ptid_t (pid);
/* Invalidate our notion of the remote current thread. */ /* Invalidate our notion of the remote current thread. */
record_currthread (rs, minus_one_ptid); record_currthread (rs, minus_one_ptid);
@ -6575,7 +6575,7 @@ remote_target::commit_resume ()
{ {
if (get_remote_inferior (inf)->may_wildcard_vcont) 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); false, GDB_SIGNAL_0);
} }
} }
@ -7530,7 +7530,7 @@ Packet: '%s'\n"),
} }
else else
error (_("unknown stop reply packet: %s"), buf); error (_("unknown stop reply packet: %s"), buf);
event->ptid = pid_to_ptid (pid); event->ptid = ptid_t (pid);
} }
break; break;
case 'N': case 'N':

View File

@ -543,7 +543,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
else else
store_waitstatus (ourstatus, status); store_waitstatus (ourstatus, status);
return pid_to_ptid (pid); return ptid_t (pid);
} }

View File

@ -848,7 +848,7 @@ s390_refresh_per_info_cb (struct lwp_info *lp, void *arg)
static int static int
s390_refresh_per_info (void) 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); iterate_over_lwps (pid_ptid, s390_refresh_per_info_cb, NULL);
return 0; return 0;

View File

@ -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); val = p_td_ta_map_id2thr (main_ta, ptid_get_tid (thread_id), &th);
if (val == TD_NOTHR) 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) else if (val != TD_OK)
error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val)); error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
val = p_td_thr_get_info (&th, &ti); val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR) 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) else if (val != TD_OK)
error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val)); error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
if (ti.ti_state != TD_THR_ACTIVE) if (ti.ti_state != TD_THR_ACTIVE)
{ {
if (default_lwp != -1) if (default_lwp != -1)
return pid_to_ptid (default_lwp); return ptid_t (default_lwp);
error (_("thread_to_lwp: thread state not active: %s"), error (_("thread_to_lwp: thread state not active: %s"),
td_state_string (ti.ti_state)); 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. */ /* It's an LWP. Convert it to a thread ID. */
if (!target_thread_alive (lwp)) 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); val = p_td_ta_map_lwp2thr (main_ta, ptid_get_lwp (lwp), &th);
if (val == TD_NOTHR) 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) else if (val != TD_OK)
error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val)); 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); val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR) 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) else if (val != TD_OK)
error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val)); 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 (); target_ops *beneath = this->beneath ();
sol_thread_active = 0; 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); unpush_target (this);
beneath->detach (inf, from_tty); beneath->detach (inf, from_tty);
} }

View File

@ -503,7 +503,7 @@ spu_linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
} }
store_waitstatus (ourstatus, status); store_waitstatus (ourstatus, status);
return pid_to_ptid (pid); return ptid_t (pid);
} }
/* Override the fetch_inferior_register routine. */ /* Override the fetch_inferior_register routine. */

View File

@ -3242,7 +3242,7 @@ target_announce_detach (int from_tty)
pid = ptid_get_pid (inferior_ptid); pid = ptid_get_pid (inferior_ptid);
printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file, 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); gdb_flush (gdb_stdout);
} }

View File

@ -1542,11 +1542,11 @@ print_inferior_quit_action (struct inferior *inf, void *arg)
if (inf->attach_flag) if (inf->attach_flag)
fprintf_filtered (stb, fprintf_filtered (stb,
_("\tInferior %d [%s] will be detached.\n"), inf->num, _("\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 else
fprintf_filtered (stb, fprintf_filtered (stb,
_("\tInferior %d [%s] will be killed.\n"), inf->num, _("\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; return 0;
} }

View File

@ -555,7 +555,7 @@ tfile_target_open (const char *arg, int from_tty)
END_CATCH END_CATCH
inferior_appeared (current_inferior (), TFILE_PID); inferior_appeared (current_inferior (), TFILE_PID);
inferior_ptid = pid_to_ptid (TFILE_PID); inferior_ptid = ptid_t (TFILE_PID);
add_thread_silent (inferior_ptid); add_thread_silent (inferior_ptid);
if (ts->traceframe_count <= 0) if (ts->traceframe_count <= 0)

View File

@ -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 can rely on it. When attaching, we don't know about any thread
id here, but that's OK --- nothing should be referencing the id here, but that's OK --- nothing should be referencing the
current thread until we report an event out of windows_wait. */ 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::init ();
target_terminal::inferior (); target_terminal::inferior ();
@ -1980,10 +1980,10 @@ windows_nat_target::attach (const char *args, int from_tty)
if (exec_file) if (exec_file)
printf_unfiltered ("Attaching to program `%s', %s\n", 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 else
printf_unfiltered ("Attaching to %s\n", 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); gdb_flush (gdb_stdout);
} }