Ejemplo n.º 1
0
        public void AddToCollection(MemOpBase aItem, SymbolLib.Generics.GenericSymbol aSymbol, uint aLinkRegisterAddress)
        {
            MemObjStatisticalCollection collection = CollectionBySymbol(aSymbol, aLinkRegisterAddress);

            if (collection == null)
            {
                // Make a new collection
                collection = new MemObjStatisticalCollection();
                iCollections.Add(collection);
            }

            collection.Add(aItem);
        }
Ejemplo n.º 2
0
        public MemObjStatisticalCollection CollectionBySymbol(SymbolLib.Generics.GenericSymbol aSymbol, uint aAddress)
        {
            // We also need a symbol...
            MemObjStatisticalCollection ret = null;

            //
            if (aSymbol != null)
            {
                int count = iCollections.Count;
                for (int i = 0; i < count; i++)
                {
                    MemObjStatisticalCollection collection = (MemObjStatisticalCollection)iCollections[i];
                    if (collection != iNullSymbolCollection)
                    {
                        System.Diagnostics.Debug.Assert(collection.Count > 0);
                        MemOpAllocation compareToObject = (MemOpAllocation)collection[0];

                        // Comparing the link register address is a very specific match - therefore we
                        // prefer the slightly slower comparison against the symbol name. This prevents
                        // multiple entries in the list that come from the same symbol (but different
                        // instruction address).. i.e. the allocation occurs within the same function,
                        // but a slightly different location.
                        if (compareToObject.LinkRegisterSymbol != null)
                        {
                            if (compareToObject.LinkRegisterSymbol.Symbol == aSymbol.Symbol)
                            {
                                ret = collection;
                                break;
                            }
                        }
                        else if (compareToObject.LinkRegisterAddress == aAddress)
                        {
                            // Symbols match, add it to this container
                            ret = collection;
                            break;
                        }
                    }
                }
            }
            else
            {
                // Must be from the null symbol collection then.
                ret = iNullSymbolCollection;
            }
            //
            return(ret);
        }