src/AsyncDbg.Core/Causality/ThreadNode.cs
/// <summary>
/// Finds a Clr instance of a given type that lives on the stack and returns an address of the instance in the heap.
/// </summary>
Finds a Clr instance of a given type that lives on the stack and returns an address of the instance in the heap.
Finds a Clr instance of a given type that lives on the stack and returns an address of the instance in the heap .
private ClrInstance? FindInstanceAddressOfType(ClrThread thread, ClrStackFrame frame, ClrType expectedType)
        {
            foreach (ulong ptr in EnumeratePointersForThreadFrame(thread, frame))
            {
                if (_runtime.ReadPointer(ptr, out ulong address))
                {
                    if (!_runtime.Heap.IsInHeap(address))
                    {
                        continue;
                    }
                    ClrType type = _runtime.Heap.GetObjectType(address);
                    if (ClrTypeEqualityComparer.Instance.Equals(expectedType, type))
                    {
                        return ClrInstance.CreateInstance(_runtime.Heap, address, type);
                    }
                }
            }
            return null;
        }
private ClrInstance ? FindInstanceAddressOfType ( ClrThread thread , ClrStackFrame frame , ClrType expectedType ) { foreach ( ulong ptr in EnumeratePointersForThreadFrame ( thread , frame ) ) { if ( _runtime . ReadPointer ( ptr , out ulong address ) ) { if ( ! _runtime . Heap . IsInHeap ( address ) ) { continue ; } ClrType type = _runtime . Heap . GetObjectType ( address ) ; if ( ClrTypeEqualityComparer . Instance . Equals ( expectedType , type ) ) { return ClrInstance . CreateInstance ( _runtime . Heap , address , type ) ; } } } return null ; }
Finds a Clr instance of a given type that lives on the stack and returns an address of the instance in the heap.
Finds a Clr instance of a given type that lives on the stack and returns an address of the instance in the heap .
thread
ClrThread
frame
ClrStackFrame
expectedType
ClrType