跟踪Xcode中的变量或内存变化? [英] Tracking variable or memory change in Xcode?

查看:665
本文介绍了跟踪Xcode中的变量或内存变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法跟踪Xcode中的变量更改或内存更改?我正在寻找像Visual Studio的数据断点这样的功能。

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 object's view frame is being changed. I want to set a breakpoint at a member variable and run it. Then I could determine where it's changed.

推荐答案

Xcode使用 gdb (或 lldb ,但这是另一个故事)来实现其调试功能。 gdb 能够设置硬件观察点,因此Xcode也是如此。

Xcode uses gdb (or lldb, but that's another story) to implement its debugging functionality. gdb has the ability to set hardware watchpoints and hence so does Xcode.

这是一个用于内存错误的通用调试的有用页面。 Xcode的调试控制台窗口实际上只是一个 gdb shell,您可以根据需要输入命令。有用的Quinn Taylor在这篇相关帖子中解释了如何做到这一点。

This is a useful page for generic debugging of memory errors. Xcode's debugging console window is really just a gdb shell, you can type in commands as you please. The ever-helpful Quinn Taylor explains how to do so in this related post.

如果你宁愿避免直接与 gdb 交互,你可以在Xcode的调试窗口中右键单击一个变量并选择观察变量。只要您的变量值发生变化,Xcode就会提醒您。

If you'd rather avoid interacting with gdb directly, you can right-click a variable in Xcode's debugging window and select "Watch Variable". Xcode will then alert you whenever your variable's value has been changed.

这篇关于跟踪Xcode中的变量或内存变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆