/// <summary> /// run step 123. /// </summary> /// <returns></returns> public override Expr Parse() { // Move past "mod" _tokenIt.Advance(); // Get the name of the module "e.g." "math" var name = _tokenIt.ExpectId(); // 1. Create the symbol to represent module var symbol = new SymbolModule(); symbol.Name = name; symbol.Category = SymbolCategory.Module; symbol.DataType = new LModuleType(); symbol.DataType.Name = name; symbol.DataType.FullName = name; symbol.Scope = new SymbolsNested(name); symbol.ParentScope = this.Ctx.Symbols.Current; // 2. Add the module symbol to the current scope this.Ctx.Symbols.Define(symbol); // 3. Now push the scope on top of the current scope. ( since modules can be nested ) this.Ctx.Symbols.Push(symbol.Scope, true); var block = new BlockExpr(); _parser.ParseBlock(block); this.Ctx.Symbols.Pop(); return(block); }
/// <summary> /// run step 123. /// </summary> /// <returns></returns> public override Expr Parse() { // Move past "mod" _tokenIt.Advance(); // Get the name of the module "e.g." "math" var name = _tokenIt.ExpectId(); // 1. Create the symbol to represent module var symbol = new SymbolModule(); symbol.Name = name; symbol.Category = SymbolCategory.Module; symbol.DataType = new LModuleType(); symbol.DataType.Name = name; symbol.DataType.FullName = name; symbol.Scope = new SymbolsNested(name); symbol.ParentScope = this.Ctx.Symbols.Current; // 2. Add the module symbol to the current scope this.Ctx.Symbols.Define(symbol); // 3. Now push the scope on top of the current scope. ( since modules can be nested ) this.Ctx.Symbols.Push(symbol.Scope, true); var block = new BlockExpr(); _parser.ParseBlock(block); this.Ctx.Symbols.Pop(); return block; }
SymbolModule FindPdbForModule(ModuleInfo module) { if (module == null) { return(null); } string pdbName; Guid pdbGuid; int rev; using (PEFile pefile = new PEFile(new ReadVirtualStream(m_dataReader, (long)module.ImageBase, (long)module.FileSize), true)) if (!pefile.GetPdbSignature(out pdbName, out pdbGuid, out rev)) { return(null); } if (!File.Exists(pdbName)) { ISymbolNotification notification = DefaultSymbolNotification ?? new NullSymbolNotification(); pdbName = Path.GetFileName(pdbName); pdbName = SymbolReader.FindSymbolFilePath(pdbName, pdbGuid, rev, notification); if (string.IsNullOrEmpty(pdbName) || !File.Exists(pdbName)) { return(null); } } if (pdbName == null) { m_symbols[module] = null; return(null); } SymbolModule symbols = null; try { symbols = new SymbolModule(SymbolReader, pdbName); m_symbols[module] = symbols; } catch { m_symbols[module] = null; return(null); } return(symbols); }
public static MemoryGraph Create(string dllPath, SymbolReader symbolReader) { var ret = new MemoryGraph(1000); string pdbPath = symbolReader.FindSymbolFilePathForModule(dllPath); symbolReader.Log.WriteLine("Got PDB path {0}", pdbPath); SymbolModule module = symbolReader.OpenSymbolFile(pdbPath); List <Symbol> symbols = new List <Symbol>(); AddAllChildren(symbols, module.GlobalSymbol); symbols.Sort(); /****** Make a graph out of the symbols ******/ // Put all nodes under this root. var rootChildren = new GrowableArray <NodeIndex>(1000); // Create a node for each symbol uint lastRVA = 0; string lastName = "Header"; var empty = new GrowableArray <NodeIndex>(); foreach (var symbol in symbols) { var symRVA = symbol.RVA; int lastSize = (int)symRVA - (int)lastRVA; NodeTypeIndex typeIdx = ret.CreateType(lastName, null, lastSize); NodeIndex nodeIdx = ret.CreateNode(); ret.SetNode(nodeIdx, typeIdx, lastSize, empty); rootChildren.Add(nodeIdx); lastName = symbol.Name; lastRVA = symRVA; } // TODO FIX NOW dropping the last symbol. // Create the root node. NodeIndex rootIdx = ret.CreateNode(); NodeTypeIndex rootTypeIdx = ret.CreateType("METHODS"); ret.SetNode(rootIdx, rootTypeIdx, 0, rootChildren); ret.RootIndex = rootIdx; ret.AllowReading(); return(ret); }
internal override string ResolveSymbol(ulong addr) { ModuleInfo module = FindModule(addr); if (module == null) { return(null); } SymbolModule sym = SymbolLocator.LoadPdb(module); if (sym == null) { return(null); } return(sym.FindNameForRva((uint)(addr - module.ImageBase))); }
internal SymbolModule LoadPdb(string pdbPath) { if (string.IsNullOrEmpty(pdbPath)) { return(null); } SymbolModule result; if (_moduleCache.TryGetValue(pdbPath, out result)) { // TODO: Add dispose on SymbolModule //if (!result.Disposed) return(result); } result = new SymbolModule(new SymbolReader(null, null), pdbPath); _moduleCache[pdbPath] = result; return(result); }
public override void LoadPdb(string path) { _symbols = _runtime.DataTarget.SymbolLocator.LoadPdb(path); }
public override void LoadPdb(string path) { m_symbols = new SymbolModule(m_runtime.DataTarget.SymbolReader, path); }