Is there a way to Track/trace and log all the methods, by Class and Method name, during a debug session?

前端 未结 3 650
面向向阳花
面向向阳花 2020-12-17 20:06

I am not interested in logging into frameworks or under the covers but only at my source level code upon entry and exit of each method. I would like it to provide Class Name

相关标签:
3条回答
  • 2020-12-17 20:18

    An alternative which you can use with iOS simulator on the Mac (arm/x86_64)

    1. Create a Symbolic Breakpoint
    2. Symbol: objc_msgSend
    3. Action: Debugger Command
    4. Command:

      p (void)printf("[%s, %s]\n", (char*)object_getClassName($arg1), $arg2)
      

      *p is an alias for expr --

    5. Check: Automatically continue after evaluating actions

    0 讨论(0)
  • 2020-12-17 20:28

    Dave Dribin covers precisely this in his article Tracing Objective-C messages.

    The part you are after is probably this:

    If you set the NSObjCMessageLoggingEnabled environment variable to YES, the Objective-C runtime will log all dispatched Objective-C messages to a file named /tmp/msgSends-<pid>.

    0 讨论(0)
  • 2020-12-17 20:30

    Xtrace (https://github.com/johnno1962/Xtrace) has many features and works well for tracing Objective-C. One needs source access to their project, like you appear to have, and can emit messages on entry/exit, like you appear to want.

    • Debug-time configuration - can hard-code or configure tracing while debugging
    • Uncomplicated integration - one .mm and one .h
    • NSRegularExpression matching - classes, methods, types
    0 讨论(0)
提交回复
热议问题