2012-07-28 72 views

回答

0

可能通过ptrace的?

ptrace -- process tracing and debugging 

概要 的#include 的#include

int 
ptrace(int request, pid_t pid, caddr_t addr, int data); 

说明 ptrace的()提供跟踪和调试设施。它允许一个进程(追踪进程)控制另一个进程(追踪进程)。

+0

对于缺少更好的答案,我会接受这一点。 – Anno2001 2014-09-10 14:35:21

+0

显然,您需要找出目标方法驻留的位置,然后修改该过程以插入调试方法调用。 http://www.linuxjournal.com/article/6210 – Anno2001 2014-09-10 14:41:33

0

这里是如何做到这一点的非编程:

root:~/DictationServices.framework$ ps -Afw | grep Preferences 
    501 44726 44621 0 7:46PM ??   0:02.60 /Applications/System Preferences.app/Contents/MacOS/System Preferences 
// pid of /Applications/System Preferences.app == 44726 
(gdb) attach 44726 
Attaching to process 44726. 
Reading symbols for shared libraries + done 
Reading symbols for shared libraries +++.+.+.+.+++++++..+++++++ done 
Reading symbols for shared libraries + done 
0x00007fff8befe686 in mach_msg_trap() 
(gdb) b dictationEnabled 
Breakpoint 3 at 0x10e57bc93 
(gdb) c 
Continuing. 
Breakpoint 3, 0x000000010e57bc93 in -[SODictationPreferences dictationEnabled]() 
(gdb)