Ejemplo n.º 1
0
        private void DoWriteHeapToFile(StreamWriter aWriter)
        {
            aWriter.WriteLine("Cell\t\tCounter\t\tLength\t\tSymbol");
            aWriter.WriteLine("");
            //
            HeapCellArray heapItems = iReconstructor.Data;

            for (int r = 0; r < heapItems.Count; r++)
            {
                HeapCell entry = (HeapCell)heapItems[r];
                //
                if (iShowOnlySymbolicMatches == false || (iShowOnlySymbolicMatches == true && entry.Symbol != null))
                {
                    StringBuilder line = new StringBuilder();
                    //
                    line.Append(entry.Address.ToString("x8"));
                    line.Append("\t");
                    line.Append(entry.AllocationNumber.ToString("d8"));
                    line.Append("\t");
                    line.Append(entry.Length.ToString("x8"));
                    line.Append("\t");
                    if (entry.Symbol != null)
                    {
                        line.Append(entry.Symbol.Name);
                    }
                    //
                    aWriter.WriteLine(line.ToString());
                }
            }
        }
Ejemplo n.º 2
0
 public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
 {
     SelectionBorder.Initialise(aCells, aReconstructor, aRenderer);
     Header.Initialise(aCells, aReconstructor, aRenderer);
     Content.Initialise(aCells, aReconstructor, aRenderer);
     ContentBorder.Initialise(aCells, aReconstructor, aRenderer);
 }
 public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
 {
     if (aReconstructor != null)
     {
         iHighestCellAllocationNumber = aReconstructor.Statistics.StatsAllocated.CellAllocationNumberLargest.AllocationNumber;
     }
 }
        public HeapToHTMLPageEntireListing(HeapReconstructor aReconstructor, TSortType aSortType, string aFileName)
            :       base(aFileName)
        {
            iSortType      = aSortType;
            iReconstructor = aReconstructor;

            // Make a new (but empty) array
            iEntries = new HeapCellArray(aReconstructor.Data.Count + 1);

            // Depending on the sort type, trigger the sort method
            // in the array. Since the array is empty this won't
            // do a lot, except set up the array to use our chosen
            // comparison object...
            switch (iSortType)
            {
            default:
            case TSortType.ESortTypeByAddress:
                iEntries.SortByAddress();
                break;

            case TSortType.ESortTypeByType:
                iEntries.SortByType();
                break;

            case TSortType.ESortTypeByLength:
                iEntries.SortByLength();
                break;
            }

            // Now copy the entries into the array
            iEntries.Copy(aReconstructor.Data);
        }
 public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
 {
     iRenderer = aRenderer;
     //
     iFactory = (FactoryByObject)aRenderer.Factory;
     iFactory.PrepareColourHashes(aReconstructor, StandardColours);
 }
Ejemplo n.º 6
0
        public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
        {
            if (aReconstructor != null)
            {
                int    min    = aReconstructor.Statistics.StatsAllocated.CellNumberOfEmbeddedReferencesLeast.RelationshipManager.EmbeddedReferencesTo.Count + 1;
                double logMin = Math.Log((double)min);
                //
                int    max    = aReconstructor.Statistics.StatsAllocated.CellNumberOfEmbeddedReferencesMost.RelationshipManager.EmbeddedReferencesTo.Count + 1;
                double logMax = Math.Log((double)max);

                iDomain = (float)(logMax - logMin);
            }
        }
 public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
 {
     if (aReconstructor != null)
     {
         uint largestLenAlloc = aReconstructor.Statistics.StatsAllocated.CellLargest.Length;
         uint largestLenFree  = aReconstructor.Statistics.StatsFree.CellLargest.Length;
         iCellLengthLongest = Math.Max(largestLenAlloc, largestLenFree);
         //
         uint smallestLenAlloc = aReconstructor.Statistics.StatsAllocated.CellSmallest.Length;
         uint smallestLenFree  = aReconstructor.Statistics.StatsFree.CellSmallest.Length;
         iCellLengthSmallest = Math.Min(smallestLenAlloc, smallestLenFree);
     }
 }
        private static int CountBySymbol(string aText, HeapCellArray aArray)
        {
            int ret   = 0;
            int count = aArray.Count;

            for (int i = 0; i < count; i++)
            {
                HeapCell cell = aArray[i];
                string   sym  = cell.SymbolStringWithoutDescriptorPrefix;
                if (sym.Contains(aText))
                {
                    ++ret;
                }
            }
            return(ret);
        }
        public RHeapExtractor(DataSource aDataSource, Options aOptions, DbgEngine aDebugEngine, RelationshipInspector aRelationshipInspector, HeapStatistics aStatistics, HeapCellArray aData)
        {
            iData                  = aData;
            iOptions               = aOptions;
            iStatistics            = aStatistics;
            iDataSource            = aDataSource;
            iDebugEngine           = aDebugEngine;
            iState                 = new ExtractionState(aDataSource);
            iRelationshipInspector = aRelationshipInspector;
            //
            HeapCell.AllocatedCellHeaderSize = AllocatedCellHeaderSize;

            // Must prime these
            iState.NextFreeCellAddress = aDataSource.MetaData.Heap.InfoFree.FreeCellAddress;
            iState.NextFreeCellLength  = aDataSource.MetaData.Heap.InfoFree.FreeCellLength;
            //
            if (iState.NextFreeCellAddress == 0)
            {
                throw new ArgumentException("Next free cell information invalid");
            }

            //iState.DebugEnabled = true;
        }
Ejemplo n.º 10
0
        private long TotalAllocatedMemory(out int aAllocCount, out int aFreeCount, out long aFreeSpaceSize, out long aAllocatedUnknownSize, out long aAllocatedSymbolMatchSize)
        {
            aAllocCount               = 0;
            aFreeCount                = 0;
            aFreeSpaceSize            = 0;
            aAllocatedUnknownSize     = 0;
            aAllocatedSymbolMatchSize = 0;
            //
            HeapCellArray data  = iReconstructor.Data;
            int           count = data.Count;

            //
            for (int i = 0; i < count; i++)
            {
                HeapCell cell = data[i];
                //
                if (cell.Type == HeapCell.TType.EAllocated)
                {
                    ++aAllocCount;
                    if (cell.Symbol != null)
                    {
                        aAllocatedSymbolMatchSize += cell.Length;
                    }
                    else
                    {
                        aAllocatedUnknownSize += cell.Length;
                    }
                }
                else
                {
                    ++aFreeCount;
                    aFreeSpaceSize += cell.Length;
                }
            }

            return(aAllocatedSymbolMatchSize + aAllocatedUnknownSize + aFreeSpaceSize);
        }
Ejemplo n.º 11
0
        private void UpdateReferenceInfoList(HeapCell aCell)
        {
            RelationshipManager relManager = aCell.RelationshipManager;

            //
            if (aCell.Symbol != null)
            {
                iGP_AssociatedWith.Text = "[0x" + aCell.Address + "] " + aCell.SymbolString;
            }
            else
            {
                iGP_AssociatedWith.Text = "[0x" + aCell.Address + "]";
            }

            //
            if (iRB_EmbeddedReferencesTo.Checked)
            {
                HeapCellArray array = new HeapCellArray();
                foreach (RelationshipInfo info in relManager.EmbeddedReferencesTo)
                {
                    array.Add(info.ToCell);
                }
                //
                iAssociatedWith.Cells = array;
            }
            else
            {
                HeapCellArray array = new HeapCellArray();
                foreach (HeapCell refCell in relManager.ReferencedBy)
                {
                    array.Add(refCell);
                }
                //
                iAssociatedWith.Cells = array;
            }
        }
Ejemplo n.º 12
0
 public void Initialise(HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer)
 {
 }
 public RelationshipInspector(HeapCellArray aEntries, HeapStatistics aStats)
     : base(null)
 {
     iEntries = aEntries;
     iStats   = aStats;
 }
 public HeapRenderingNavigator(HeapCellArray aCells)
 {
     iCells = aCells;
     //
     iMetaData = new HeapCellMetaData(this);
 }