Пример #1
0
        public bool Load(string FileName)
        {
            if (!File.Exists(FileName))
            {
                return(false);
            }

            HLECacheFile CacheFile = new HLECacheFile();

            if (!CacheFile.Load(FileName))
            {
                return(false);
            }

            foreach (KeyValuePair <uint, string> Item in CacheFile.AddressMap)
            {
                DebuggerSymbol NewSymbol = new DebuggerSymbol();
                NewSymbol.Name      = Item.Value;
                NewSymbol.AddrBegin = Item.Key;

                AddSymbol(NewSymbol);
            }

            return(true);
        }
        public DebuggerSymbol FindSymbol(uint Address)
        {
            if (Providers.Count == 0)
            {
                return(null);
            }

            DebuggerSymbol BestResult = null;

            // Find the first provider who can give a symbol for this address

            int ProviderIndex = 0;

            do
            {
                BestResult = Providers[ProviderIndex].FindSymbolFromAddress(Address);
                if (BestResult != null)
                {
                    break;
                }

                ++ProviderIndex;
            }while (ProviderIndex < Providers.Count);

            // Failed to find any symbols
            if (BestResult == null)
            {
                return(null);
            }

            // Found an exact match
            if (BestResult.AddrBegin == Address)
            {
                return(BestResult);
            }

            // Otherwise, try and find another symbol which is closer to the given address
            // TODO Investigate adding symbol size metadata this can just check if Address is within a given range

            for (int i = ProviderIndex + 1; i < Providers.Count; ++i)
            {
                DebuggerSymbol OtherResult = Providers[i].FindSymbolFromAddress(Address);
                if (OtherResult == null)
                {
                    continue;
                }

                if (OtherResult.AddrBegin < BestResult.AddrBegin)
                {
                    BestResult = OtherResult;
                }
            }

            return(BestResult);
        }
 protected void RemoveSymbol(DebuggerSymbol Symbol)
 {
     Symbols.Remove(Symbol.AddrBegin);
 }
 protected void AddSymbol(DebuggerSymbol Symbol)
 {
     Symbols.Add(Symbol.AddrBegin, Symbol);
 }