本文整理汇总了C++中pid_to_ptid函数的典型用法代码示例。如果您正苦于以下问题:C++ pid_to_ptid函数的具体用法?C++ pid_to_ptid怎么用?C++ pid_to_ptid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pid_to_ptid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:atgreen,项目名称:binutils-gdb,代码行数:30,代码来源:inf-ptrace.c
示例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);
}
开发者ID:nds32,项目名称:binutils,代码行数:7,代码来源:i386-linux-nat.c
示例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));
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-gdb,代码行数:28,代码来源:inf-ptrace.c
示例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);
}
开发者ID:jichu4n,项目名称:prc-tools-remix,代码行数:7,代码来源:sol-thread.c
示例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;
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:47,代码来源:inf-ptrace.c
示例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);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:9,代码来源:inferiors.c
示例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);
}
开发者ID:ArmstrongJ,项目名称:insight-debugger,代码行数:9,代码来源:i386-linux-nat.c
示例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);
}
开发者ID:dbl001,项目名称:binutils,代码行数:9,代码来源:amd64-linux-nat.c
示例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;
}
开发者ID:atgreen,项目名称:binutils-gdb,代码行数:56,代码来源:inf-ptrace.c
示例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);
}
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:53,代码来源:rs6000-nat.c
示例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;
}
开发者ID:AhmadTux,项目名称:freebsd-ports,代码行数:12,代码来源:fbsd-threads.c
示例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;
}
开发者ID:Bracksun,项目名称:binutils-gdb,代码行数:12,代码来源:inferiors.c
示例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 ();
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:13,代码来源:fbsd-threads.c
示例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;
}
}
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:54,代码来源:win32-low.c
示例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;
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:14,代码来源:inferiors.c
示例16: pull_pid_from_list
int
pull_pid_from_list (struct inferior_list *list, unsigned long pid)
{
struct inferior_list_entry *new_entry;
new_entry = find_inferior_id (list, pid_to_ptid (pid));
if (new_entry == NULL)
return 0;
else
{
remove_inferior (list, new_entry);
free (new_entry);
return 1;
}
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:15,代码来源:inferiors.c
示例17: 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;
if (cached_status.kind != TARGET_WAITKIND_IGNORE)
{
/* The core always does a wait after creating the inferior, and
do_initial_child_stuff already ran the inferior to the
initial breakpoint (or an exit, if creating the process
fails). Report it now. */
*ourstatus = cached_status;
cached_status.kind = TARGET_WAITKIND_IGNORE;
return debug_event_ptid (¤t_event);
}
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_thread, 1);
child_fetch_inferior_registers (regcache, -1);
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;
}
}
}
开发者ID:phausler,项目名称:binutils,代码行数:50,代码来源:win32-low.c
示例18: nbsd_thread_proc_getregs
static int
nbsd_thread_proc_getregs (void *arg, int regset, int lwp, void *buf)
{
struct nbsd_thread_proc_arg *a = (struct nbsd_thread_proc_arg *) arg;
struct regcache *cache = a->cache;
struct target_ops *ops = a->ops;
struct cleanup *old_chain;
struct target_ops *beneath = find_target_beneath (ops);
int ret;
old_chain = save_inferior_ptid ();
if (target_has_execution)
{
/* Fetching registers from a live process requires that
inferior_ptid is a LWP value rather than a thread value. */
inferior_ptid = ptid_build (ptid_get_pid (main_ptid), lwp, 0);
beneath->to_fetch_registers (beneath, cache, -1);
}
else
{
/* Fetching registers from a core process requires that
the PID value of inferior_ptid have the funky value that
the kernel drops rather than the real PID. Gross. */
inferior_ptid = pid_to_ptid ((lwp << 16) | ptid_get_pid (main_ptid));
beneath->to_fetch_registers (ops, cache, -1);
}
ret = 0;
switch (regset)
{
case 0:
fill_gregset (cache, (gregset_t *)buf, -1);
break;
case 1:
#ifdef HAVE_FPREGS
fill_fpregset (cache, (fpregset_t *)buf, -1);
#endif
break;
default: /* XXX need to handle other reg sets: SSE, AltiVec, etc. */
ret = TD_ERR_INVAL;
}
do_cleanups (old_chain);
return ret;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:47,代码来源:nbsd-thread.c
示例19: maybe_attach_thread
static int
maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p,
int *counter)
{
struct lwp_info *lwp;
lwp = find_lwp_pid (pid_to_ptid (ti_p->ti_lid));
if (lwp != NULL)
return 1;
if (!attach_thread (th_p, ti_p))
return 0;
if (counter != NULL)
*counter += 1;
return 1;
}
开发者ID:cupertinomiranda,项目名称:binutils,代码行数:18,代码来源:thread-db.c
示例20: fbsd_add_threads
static void
fbsd_add_threads (pid_t pid)
{
struct cleanup *cleanup;
lwpid_t *lwps;
int i, nlwps;
gdb_assert (!in_thread_list (pid_to_ptid (pid)));
nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0);
if (nlwps == -1)
perror_with_name (("ptrace"));
lwps = XCNEWVEC (lwpid_t, nlwps);
cleanup = make_cleanup (xfree, lwps);
nlwps = ptrace (PT_GETLWPLIST, pid, (caddr_t) lwps, nlwps);
if (nlwps == -1)
perror_with_name (("ptrace"));
for (i = 0; i < nlwps; i++)
{
ptid_t ptid = ptid_build (pid, lwps[i], 0);
if (!in_thread_list (ptid))
{
#ifdef PT_LWP_EVENTS
struct ptrace_lwpinfo pl;
/* Don't add exited threads. Note that this is only called
when attaching to a multi-threaded process. */
if (ptrace (PT_LWPINFO, lwps[i], (caddr_t) &pl, sizeof pl) == -1)
perror_with_name (("ptrace"));
if (pl.pl_flags & PL_FLAG_EXITED)
continue;
#endif
if (debug_fbsd_lwp)
fprintf_unfiltered (gdb_stdlog,
"FLWP: adding thread for LWP %u\n",
lwps[i]);
add_thread (ptid);
}
}
do_cleanups (cleanup);
}
开发者ID:Distrotech,项目名称:binutils,代码行数:44,代码来源:fbsd-nat.c
注:本文中的pid_to_ptid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论