Xcode watchpoints

Watchpoints are used to monitor the value of a variable for changes, and to trigger a pause in the debugger when these changes happen. Hence, they can be very helpful in identifying state-related problems in your program – that you might not know precisely how to track down.


Do it yourself

  1. Put a breakpoint in one of the methods; where you can print the value of the variable.
  2. Navigate to Variables View
  3. Expose the variable name (eg. by expanding self if it is an ivar)
  4. Right click on the variable name and select - Watch <name_of_your_var>

Alternatively, you can also type in the LLDB console to set the watchpoint

watch set variable  your_var_name

A watchpoint watches for changes to the variable you specify. This means that when the variable’s value is set, the watchpoint will hit.

Change variables type to "All".

Check "value" for your variable.

NOTE: Watchpoints are not saved between executions of your program.


Read more on - www.amreshkumar.com



要查看或添加评论,请登录

Amresh K.的更多文章

  • Micro refactoring series — Crafting a changeset

    Micro refactoring series — Crafting a changeset

    When working on features and bugs, developers tend to go deep into the code and often make many changes in one go. It’s…

  • Micro Refactoring Series — Building the foundation

    Micro Refactoring Series — Building the foundation

    As developers, it's tempting to focus on creating new features and functionalities. However, it's crucial to take a…

    1 条评论
  • Thinking SOLID for iOS : Single Responsibility

    Thinking SOLID for iOS : Single Responsibility

    I start by quoting - Don't follow an architecture, but the principle. Most of you reading this - I suppose you are an…

    5 条评论
  • Symbolic Breakpoints in Xcode

    Symbolic Breakpoints in Xcode

    Symbolic breakpoint is one of the few amazing features of Xcode. It allows you to add a breakpoint against every method…

社区洞察

其他会员也浏览了