/// <summary> Lookup symbols for callstack addresses in passed in FStreamInfo.GlobalInstance. </summary>
        private static void LookupSymbols(FProfileDataHeader Header, MainWindow MainMProfWindow, BinaryReader BinaryStream, BackgroundWorker BGWorker)
        {
            string PrettyFilename = Path.GetFileNameWithoutExtension(FStreamInfo.GlobalInstance.FileName);

            BGWorker.ReportProgress(0, "2/8 Loading symbols for " + PrettyFilename);

            if (FStreamInfo.GlobalInstance.SymbolParser != null)
            {
                FStreamInfo.GlobalInstance.SymbolParser.ShutdownSymbolService();
            }

            // Proper Symbol parser will be created based on platform.
            FStreamInfo.GlobalInstance.SymbolParser = ISymbolParser.GetSymbolParserForPlatform(Header.PlatformName);

            if (FStreamInfo.GlobalInstance.SymbolParser != null)
            {
                FStreamInfo.GlobalInstance.SymbolParser.InitializeSymbolService(Header.ExecutableName, new FUIBroker(MainMProfWindow));
                if (FStreamInfo.GlobalInstance.ModuleInfoArray != null && FStreamInfo.GlobalInstance.ModuleInfoArray.Count > 0)
                {
                    FStreamInfo.GlobalInstance.SymbolParser.SetModuleOffset(FStreamInfo.GlobalInstance.ModuleInfoArray[0].BaseOfImage);
                }
            }

            // Nothing more to do if symbols were serialized at runtime (we just needed to create the correct symbol parser)
            if (Header.bShouldSerializeSymbolInfo)
            {
                return;
            }

            if (FStreamInfo.GlobalInstance.SymbolParser != null)
            {
                // Iterate over all addresses and look up symbol information.
                int    NumAddressesPerTick = FStreamInfo.GlobalInstance.CallStackAddressArray.Count / 100;
                int    AddressIndex        = 0;
                string ProgressString      = "3/8 Resolving symbols for " + PrettyFilename;

                foreach (FCallStackAddress Address in FStreamInfo.GlobalInstance.CallStackAddressArray)
                {
                    if ((AddressIndex % NumAddressesPerTick) == 0)
                    {
                        BGWorker.ReportProgress(AddressIndex / NumAddressesPerTick, ProgressString);
                    }
                    ++AddressIndex;

                    FStreamInfo.GlobalInstance.SymbolParser.ResolveAddressSymbolInfo(ESymbolResolutionMode.Fast, Address);
                }
            }
        }
 public LabelInstructionParser(IInstructionParser nextParser, ISymbolParser labelParser)
 {
     _nextParser  = nextParser;
     _labelParser = labelParser;
 }
 public VariableInstructionParser(IInstructionParser nextParser, ISymbolParser labelParser)
 {
     _nextParser = nextParser;
     _labelParser = labelParser;
 }
示例#4
0
 public PostfixCalculator()
 {
     symbolParser     = new SymbolParser();
     postfixConverter = new PostfixShuntingYardConverter();
 }