How to set a conditional breakpoint in Xcode based on an object string property?

后端 未结 5 1125
鱼传尺愫
鱼传尺愫 2020-12-02 05:21

I\'m looking to be able to have the debugger break when it reaches a particular string match. As an example, I might have something like this:

Foo myObj = [s         


        
5条回答
  •  没有蜡笔的小新
    2020-12-02 05:30

    If you mutate myObj.name using the setter, you can add a symbolic breakpoint on -[MyObjClass setName:] either from the Debugger Console or from the Run->Manage Breakpoints->Add Symbolic Breakpoint menu in Xcode. If not (why not? you probably shouldn't be modifying the instance variable directly except in the designated initializer or dealloc) you can set a watchpoint in gdb (use the Debugger Console in Xcode once the debugger is running). This page explains how. I don't believe Xcode exposes a UI for setting watchpoints without using the Debugger Console.

提交回复
热议问题