Comparing two Object addresses in WinDbg
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.
精彩评论