本文整理汇总了C++中pid_to_ptid函数的典型用法代码示例。如果您正苦于以下问题:C++ pid_to_ptid函数的具体用法?C++ pid_to_ptid怎么用?C++ pid_to_ptid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pid_to_ptid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inf_ptrace_create_inferior
static void
inf_ptrace_create_inferior (struct target_ops *ops,
char *exec_file, char *allargs, char **env,
int from_tty)
{
int pid;
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
int ops_already_pushed = target_is_pushed (ops);
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
if (! ops_already_pushed)
{
/* Clear possible core file with its process_stratum. */
push_target (ops);
make_cleanup_unpush_target (ops);
}
pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
NULL, NULL, NULL);
discard_cleanups (back_to);
startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
/* On some targets, there must be some explicit actions taken after
the inferior has been started up. */
target_post_startup_inferior (pid_to_ptid (pid));
}
示例2: i386_linux_dr_set_control
static void
i386_linux_dr_set_control (unsigned long control)
{
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
示例3: inf_ptrace_create_inferior
static void
inf_ptrace_create_inferior (struct target_ops *ops,
char *exec_file, char *allargs, char **env,
int from_tty)
{
int pid;
pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
NULL, NULL);
push_target (ops);
/* On some targets, there must be some explicit synchronization
between the parent and child processes after the debugger
forks, and before the child execs the debuggee program. This
call basically gives permission for the child to exec. */
target_acknowledge_created_inferior (pid);
/* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h, and will
be 1 or 2 depending on whether we're starting without or with a
shell. */
startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
/* On some targets, there must be some explicit actions taken after
the inferior has been started up. */
target_post_startup_inferior (pid_to_ptid (pid));
}
示例4: sol_thread_detach
static void
sol_thread_detach (char *args, int from_tty)
{
inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid));
unpush_target (&sol_thread_ops);
procfs_ops.to_detach (args, from_tty);
}
示例5: inf_ptrace_follow_fork
static int
inf_ptrace_follow_fork (struct target_ops *ops, int follow_child)
{
pid_t pid, fpid;
ptrace_state_t pe;
/* FIXME: kettenis/20050720: This stuff should really be passed as
an argument by our caller. */
{
ptid_t ptid;
struct target_waitstatus status;
get_last_target_status (&ptid, &status);
gdb_assert (status.kind == TARGET_WAITKIND_FORKED);
pid = ptid_get_pid (ptid);
}
if (ptrace (PT_GET_PROCESS_STATE, pid,
(PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
perror_with_name (("ptrace"));
gdb_assert (pe.pe_report_event == PTRACE_FORK);
fpid = pe.pe_other_pid;
if (follow_child)
{
inferior_ptid = pid_to_ptid (fpid);
detach_breakpoints (pid);
/* Reset breakpoints in the child as appropriate. */
follow_inferior_reset_breakpoints ();
if (ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
}
else
{
inferior_ptid = pid_to_ptid (pid);
detach_breakpoints (fpid);
if (ptrace (PT_DETACH, fpid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
}
return 0;
}
示例6: add_pid_to_list
void
add_pid_to_list (struct inferior_list *list, unsigned long pid)
{
struct inferior_list_entry *new_entry;
new_entry = xmalloc (sizeof (struct inferior_list_entry));
new_entry->id = pid_to_ptid (pid);
add_inferior_to_list (list, new_entry);
}
示例7: i386_linux_dr_set_addr
static void
i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL);
}
示例8: amd64_linux_dr_set_addr
static void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
示例9: inf_ptrace_follow_fork
static int
inf_ptrace_follow_fork (struct target_ops *ops, int follow_child,
int detach_fork)
{
pid_t pid, fpid;
ptrace_state_t pe;
pid = ptid_get_pid (inferior_ptid);
if (ptrace (PT_GET_PROCESS_STATE, pid,
(PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
perror_with_name (("ptrace"));
gdb_assert (pe.pe_report_event == PTRACE_FORK);
fpid = pe.pe_other_pid;
if (follow_child)
{
struct inferior *parent_inf, *child_inf;
struct thread_info *tp;
parent_inf = find_inferior_pid (pid);
/* Add the child. */
child_inf = add_inferior (fpid);
child_inf->attach_flag = parent_inf->attach_flag;
copy_terminal_info (child_inf, parent_inf);
child_inf->pspace = parent_inf->pspace;
child_inf->aspace = parent_inf->aspace;
/* Before detaching from the parent, remove all breakpoints from
it. */
remove_breakpoints ();
if (ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
/* Switch inferior_ptid out of the parent's way. */
inferior_ptid = pid_to_ptid (fpid);
/* Delete the parent. */
detach_inferior (pid);
add_thread_silent (inferior_ptid);
}
else
{
/* Breakpoints have already been detached from the child by
infrun.c. */
if (ptrace (PT_DETACH, fpid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
}
return 0;
}
示例10: rs6000_wait
static ptid_t
rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
pid_t pid;
int status, save_errno;
do
{
set_sigint_trap ();
set_sigio_trap ();
do
{
pid = waitpid (ptid_get_pid (ptid), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
clear_sigio_trap ();
clear_sigint_trap ();
if (pid == -1)
{
fprintf_unfiltered (gdb_stderr,
_("Child process unexpectedly missing: %s.\n"),
safe_strerror (save_errno));
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return minus_one_ptid;
}
/* Ignore terminated detached child processes. */
if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
pid = -1;
}
while (pid == -1);
/* AIX has a couple of strange returns from wait(). */
/* stop after load" status. */
if (status == 0x57c)
ourstatus->kind = TARGET_WAITKIND_LOADED;
/* signal 0. I have no idea why wait(2) returns with this status word. */
else if (status == 0x7f)
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
/* A normal waitstatus. Let the usual macros deal with it. */
else
store_waitstatus (ourstatus, status);
return pid_to_ptid (pid);
}
示例11: fbsd_thread_deactivate
static void
fbsd_thread_deactivate (void)
{
if (target_has_execution)
disable_thread_event_reporting();
td_ta_delete_p (thread_agent);
inferior_ptid = pid_to_ptid (proc_handle.pid);
proc_handle.pid = 0;
fbsd_thread_active = 0;
fbsd_thread_present = 0;
}
示例12: add_process
struct process_info *
add_process (int pid, int attached)
{
struct process_info *process = XCNEW (struct process_info);
process->entry.id = pid_to_ptid (pid);
process->attached = attached;
add_inferior_to_list (&all_processes, &process->entry);
return process;
}
示例13: fbsd_thread_deactivate
static void
fbsd_thread_deactivate (void)
{
if (fbsd_thread_core == 0)
disable_thread_event_reporting();
td_ta_delete_p (thread_agent);
inferior_ptid = pid_to_ptid (proc_handle.pid);
proc_handle.pid = 0;
fbsd_thread_active = 0;
fbsd_thread_present = 0;
init_thread_list ();
}
示例14: win32_wait
/* Wait for the inferior process to change state.
STATUS will be filled in with a response code to send to GDB.
Returns the signal which caused the process to stop. */
static ptid_t
win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
{
struct regcache *regcache;
while (1)
{
if (!get_child_debug_event (ourstatus))
continue;
switch (ourstatus->kind)
{
case TARGET_WAITKIND_EXITED:
OUTMSG2 (("Child exited with retcode = %x\n",
ourstatus->value.integer));
win32_clear_inferiors ();
return pid_to_ptid (current_event.dwProcessId);
case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_LOADED:
OUTMSG2 (("Child Stopped with signal = %d \n",
ourstatus->value.sig));
regcache = get_thread_regcache (current_inferior, 1);
child_fetch_inferior_registers (regcache, -1);
if (ourstatus->kind == TARGET_WAITKIND_LOADED
&& !server_waiting)
{
/* When gdb connects, we want to be stopped at the
initial breakpoint, not in some dll load event. */
child_continue (DBG_CONTINUE, -1);
break;
}
/* We don't expose _LOADED events to gdbserver core. See
the `dlls_changed' global. */
if (ourstatus->kind == TARGET_WAITKIND_LOADED)
ourstatus->kind = TARGET_WAITKIND_STOPPED;
return debug_event_ptid (¤t_event);
default:
OUTMSG (("Ignoring unknown internal event, %d\n", ourstatus->kind));
/* fall-through */
case TARGET_WAITKIND_SPURIOUS:
case TARGET_WAITKIND_EXECD:
/* do nothing, just continue */
child_continue (DBG_CONTINUE, -1);
break;
}
}
}
示例15: add_process
struct process_info *
add_process (int pid, int attached)
{
struct process_info *process;
process = xcalloc (1, sizeof (*process));
process->entry.id = pid_to_ptid (pid);
process->attached = attached;
add_inferior_to_list (&all_processes, &process->entry);
return process;
}