When developing APIs, we strive to eliminate interdependencies between software components. Sometimes doing so completely is unachievable so one pattern we use is the delegation pattern to limit how much components can know about each other. This pattern consists of the
delegator which is typically a reusable library component, and a
delegate which is typically a custom controller1.
How can your program detect if it’s being attached to a debugger? One approach is detecting if a mach exception handler is configured. Another more well known approach is detecting the usage of
ptrace. I will discuss the merits and disadvantages of both of these.