Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Compute _sizeofPlugAndGap based on pointer size
  • Loading branch information
cshung committed Aug 18, 2021
commit 6f3393a6c393c52219748ecf3c18e2ea163c2a9d
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool IHeapHelpers.CreateSegments(ClrHeap clrHeap, out ImmutableArray<ClrSegment>
}

bool result = false;
SegmentBuilder segBuilder = new SegmentBuilder(_sos);
SegmentBuilder segBuilder = new SegmentBuilder(_sos, DataReader.PointerSize);
if (clrHeap.IsServer)
{
ClrDataAddress[] heapList = _sos.GetHeapList(clrHeap.LogicalHeapCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ internal sealed class SegmentBuilder : ISegmentData

// Regions only
private int _generation;
private ulong _sizeofPlugAndGap;

public SegmentBuilder(SOSDac sos)
public SegmentBuilder(SOSDac sos, int pointerSize)
{
_sos = sos;
_sizeofPlugAndGap = (ulong)pointerSize * 4;
}

public bool Initialize(ulong address, int generation, in HeapDetails heap)
Expand All @@ -48,9 +50,8 @@ public bool Initialize(ulong address, int generation, in HeapDetails heap)

#region ISegmentData
public int LogicalHeap { get; set; }

// 0x20 is sizeof(aligned_plug_and_gap)
public ulong BaseAddress => _regions ? (_segment.Start - 0x20) : _segment.Address;

public ulong BaseAddress => _regions ? (_segment.Start - _sizeofPlugAndGap) : _segment.Address;

public ulong Start => _segment.Start;

Expand Down