首页 > 解决方案 > macOS ptrace PT_GETREGS 似乎不存在

问题描述

我想尝试使用ptrace. 似乎大多数实现ptrace都有某种PTRACE_GETREGS返回 a 的选项struct user_regs_struct

但是在查看ptrace 的 macOS 文档后,我有点困惑,因为没有选项可以PT_GETREGS作为request参数的选项列出。但是在“错误”的底部,文档说:

 [EINVAL]
       oo   PT_GETREGS, PT_SETREGS, PT_GETFPREGS, or PT_SETFPREGS was
           attempted on a process with no valid register set.  (This is
           normally true only of system processes.)

这似乎意味着PT_GETREGS存在。我试过使用它,但我得到了

error: use of undeclared identifier 'PT_GETREGS'

PT_GETREGSmacOS ptrace 中确实存在吗?

标签: cmacosmacos-catalina

解决方案


推荐阅读