+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.
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
{
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
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
{
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);
}
struct update_registers_data data;
pid = ptid_get_pid (inferior_ptid);
- pid_ptid = pid_to_ptid (pid);
+ pid_ptid = ptid_t (pid);
if (watchpoint)
{
struct update_registers_data data;
pid = ptid_get_pid (inferior_ptid);
- pid_ptid = pid_to_ptid (pid);
+ pid_ptid = ptid_t (pid);
if (watchpoint)
{
/* 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)
{
/* 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);
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
/* 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. */
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);
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);
}
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;
{
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"));
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
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;
+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.
{
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)
{
/* 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)
{
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);
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, "
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.
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;
#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];
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;
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
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 ())
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;
}
{
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;
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
else
kill_inferior (pid);
- discard_queued_stop_replies (pid_to_ptid (pid));
+ discard_queued_stop_replies (ptid_t (pid));
});
}
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))
{
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
{
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;
/* 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;
}
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",
/* 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);
/* 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);
}
}
}
- return pid_to_ptid (SOME_PID);
+ return ptid_t (SOME_PID);
}
static void
save_npx ();
#endif
- inferior_ptid = pid_to_ptid (SOME_PID);
+ inferior_ptid = ptid_t (SOME_PID);
inf = current_inferior ();
inferior_appeared (inf, SOME_PID);
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. */
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);
}
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. */
{
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);
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
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 ();
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;
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;
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;
}
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
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>");
}
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,
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,
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 ();
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);
{
/* 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
{
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);
{
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 "
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;
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)
if (fork)
return fork->ptid;
else
- return pid_to_ptid (-1);
+ return ptid_t (-1);
}
static void
/* 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 ())
{
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.
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;
}
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. */
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. */
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;
}
if (target_supports_multi_process ())
- resume_ptid = pid_to_ptid (pid);
+ resume_ptid = ptid_t (pid);
else
resume_ptid = minus_one_ptid;
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);
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);
}
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;
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 ();
}
while (pid == -1);
- ptid = pid_to_ptid (pid);
+ ptid = ptid_t (pid);
if (WIFSTOPPED (status))
{
{
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);
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);
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);
}
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);
}
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);
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;
/* If wait returns -1, that's what we return
to GDB. */
if (temp < 0)
- retval = pid_to_ptid (temp);
+ retval = ptid_t (temp);
}
}
else
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);
/* 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);
/* 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);
}
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" =================== */
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");
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
{
{
/* 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)
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);
}
}
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 ())
{
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);
{
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);
}
}
}
else
error (_("unknown stop reply packet: %s"), buf);
- event->ptid = pid_to_ptid (pid);
+ event->ptid = ptid_t (pid);
}
break;
case 'N':
else
store_waitstatus (ourstatus, status);
- return pid_to_ptid (pid);
+ return ptid_t (pid);
}
\f
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;
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));
}
/* 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));
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));
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);
}
}
store_waitstatus (ourstatus, status);
- return pid_to_ptid (pid);
+ return ptid_t (pid);
}
/* Override the fetch_inferior_register routine. */
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);
}
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;
}
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)
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 ();
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);
}