开发者

Comparing two Object addresses in WinDbg

开发者 https://www.devze.com 2022-12-23 14:34 出处:网络
Is there a way to k开发者_高级运维now 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.In most

Is there a way to k开发者_高级运维now 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号