在 WinDbg 中比较两个对象地址

发布于 2024-08-26 04:59:36 字数 61 浏览 8 评论 0原文

有没有办法知道两个地址(对两个对象的引用)是否连接?我所说的连接是指其中一个对象是否拥有对另一个对象的引用。

Is there a way to know if two addresses, which are references to two objects are connected ? By connected I mean whether one of the objects holds a reference to the other object.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕梦 2024-09-02 04:59:36

在大多数语言中,存储引用另一个对象的内存将包含指向另一个对象的指针。那么困难在于确定这段记忆从哪里开始和结束。

如果您使用 .Net,有一个名为 sosex 的 Windbg 扩展,它公开了一个 !refs 命令,显示立即来自和到给定​​对象的引用。

如果使用本机代码,可以使用 !heap -p -a 获取包含某个对象的逻辑内存块,然后检查该内存是否包含指向另一个对象内存的指针。

In most languages, the memory storing the object referencing the other will contain a pointer to the other object. The difficulty is then to determine where this memory starts and end.

If you are in .Net, there is a windbg extension named sosex that exposes a !refs command displaying the immediate references from and to a given object.

If you are in native code, you can use !heap -p -a to obtain the logical memory block containing an object and then check if this memory contains a pointer to the memory of the other object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文