1

假设 Apple 使用了一个私有框架 DictationServices.framework,它有一个带有符号/方法 dictationEnabled 的 @interface SODictationPreferences。如何以编程方式在该方法上设置断点(使用 ObjectiveC)?

4

2 回答 2

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) 
于 2012-07-28T17:55:02.930 回答
0

可能通过ptrace?

 ptrace -- process tracing and debugging

概要 #include #include

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

说明 ptrace() 提供跟踪和调试工具。它允许一个进程(跟踪进程)控制另一个进程(跟踪进程)。

于 2012-08-18T21:41:41.937 回答