Tracking variable or memory change in Xcode?

前端 未结 4 944
半阙折子戏
半阙折子戏 2020-12-08 21:15

Is there any way to track variable changes or memory changes in Xcode? I\'m looking for functionality like Visual Studio\'s data breakpoint.

I want to know where my

4条回答
  •  不思量自难忘°
    2020-12-08 21:57

    You can use hardware watchpoints.


    You have to get the address of the variable you want to track (type p &my_var in gdb prompt).

    It will print somehting like 0x12345678.

    • With gdb: type watch *(int *)0x12345678.

    • With lldb: watch set expression (int *)0x12345678 (or w s e (int *)0x12345678)

    This assumes your variable is an int. It will create an hardware watchpoint on this address.


    Hope this helps.

提交回复
热议问题