Sobes.tech
Junior — Middle

How can you track all calls to a function that is not present in the source code during debugging?

sobes.tech AI

Answer from AI

To track all calls to a function that is not present in the source code during debugging on iOS, you can use the following approaches:

  • Set a breakpoint by function name in LLDB: if the function is known by name, you can set a breakpoint on its call in the LLDB debugger, even if its source code is missing.

    (lldb) breakpoint set --name function_name
    
  • Use symbols and dynamic loading: if the function is loaded dynamically (for example, from a framework), you can track its calls using tools like Instruments or DTrace.

  • Swizzling (method interception): in Objective-C, you can replace the implementation of a method with your own to log calls.

  • Tracing tools: such as Instruments with the "Trace" or "Time Profiler" templates, allow you to track function calls at the binary level.

Thus, even without source code, you can track calls to the desired function using a debugger and profiling tools.