2012-07-28 110 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)