public void ShowMethodBlocks(MethodEntry methodEntry) { Method = methodEntry; if (methodEntry != null) { BindMethodBlocks(methodEntry.Blocks); } else { ClearPane(); } }
/// <summary> /// Called when receiving a report about a method /// </summary> /// <param name="methodName"></param> /// <param name="methodSig"></param> /// <param name="bodySize"></param> /// <param name="flags"></param> /// <param name="implFlags"></param> /// <param name="symbolFileId"></param> /// <param name="methodDef"></param> public void EnterMethod(string methodName, string methodSig, int bodySize, uint flags, uint implFlags, int symbolFileId, int methodDef) { currentTypedef.Methods.Add(currentMethod = new MethodEntry { Type = currentTypedef, Name = methodName, Signature = methodSig, BodySize = bodySize, MethodDef = methodDef, Flags = (MethodAttributes)flags, ImplFlags = (MethodImplAttributes)implFlags }); if (_symbolReader != null) { var token = new SymbolToken(methodDef); ISymbolMethod method; try { method = _symbolReader.GetMethod(token); var count = method.SequencePointCount; int[] offsets = new int[count]; int[] sls = new int[count]; int[] scs = new int[count]; int[] els = new int[count]; int[] ecs = new int[count]; ISymbolDocument[] docs = new ISymbolDocument[count]; method.GetSequencePoints(offsets, docs, sls, scs, els, ecs); for (int i = 0; i < count; i++) { MethodBlock block = new MethodBlock(); block.Offset = offsets[i]; var fileId = GetFileIdentifier(docs[i].URL); if (fileId > 0 && sls[i] != 0xFEEFEE) { block.Start = new Position { Column = scs[i], Line = sls[i] }; block.End = new Position { Column = ecs[i], Line = els[i] }; block.File = fileId; } currentMethod.Blocks.Add(block); } docs = null; } catch (Exception ex) { } finally { method = null; } } }
public void Select(MethodEntry method) { SelectionHandlers.ForEach(x => x.Select(method)); }
private static void CopyCoverage(MethodEntry dst, MethodEntry src) { dst.BodySize = Math.Max(dst.BodySize, src.BodySize); foreach (var el in src.Blocks) { var srcBlock = el; var dstBlock = dst.Blocks.Find(x => x.Offset == srcBlock.Offset); if (dstBlock == null) { dst.Blocks.Add(srcBlock.Copy()); } else { dstBlock.VisitCount = srcBlock.VisitCount; } } }
public static int ForEventRemove(MethodEntry md) { return VSImage.Current.EventRemove; }
public static int ForEventAdd(MethodEntry md) { return VSImage.Current.EventAdd; }
public static int ForPropertySet(MethodEntry md) { return VSImage.Current.PropertySet; }
public static int ForMethod(MethodEntry md) { var access = Methods.GetAccess(md.Flags); if (Methods.IsStatic(md.Flags)) { access |= MethodAttributes.Static; } int index; if (methodImages.TryGetValue(access, out index)) return index; return -1; }
public static void Load(XmlElement node, Report report) { report.Date = ReadAttributeDate(node, "date"); foreach (var dFile in SelectChildNodes(node, "file")) { report.Files.Add(new FileEntry { Id = ReadAttributeInt(dFile, "id"), PathUri = ReadAttribute(dFile, "url") }); } foreach (var asmNode in SelectChildNodes(node, "assembly")) { report.Assemblies.Add(new AssemblyEntry { AssemblyRef = ReadAttributeInt(asmNode, "id"), Name = ReadAttribute(asmNode, "name"), Module = ReadAttribute(asmNode, "module"), Domain = ReadAttribute(asmNode, "domain"), DomainIndex = ReadAttributeInt(asmNode, "domainIdx") }); } foreach (var typeNode in SelectChildNodes(node, "type")) { var assmRef = ReadAttributeInt(typeNode, "asmref"); var assemblyEntry = report.Assemblies.Find(x => x.AssemblyRef == assmRef); if (assemblyEntry == null) { continue; } var typedefEntry = new TypedefEntry { Name = ReadAttribute(typeNode, "name"), Attributes = (TypeAttributes)ReadAttributeLong(typeNode, "flags"), Assembly = assemblyEntry }; assemblyEntry.Types.Add(typedefEntry); foreach (var methodNode in SelectChildNodes(typeNode, "method")) { var methodEntry = new MethodEntry { Name = ReadAttribute(methodNode, "name"), Signature = ReadAttribute(methodNode, "sig"), BodySize = ReadAttributeInt(methodNode, "bodysize"), Flags = (MethodAttributes)ReadAttributeLong(methodNode, "flags"), ImplFlags = (MethodImplAttributes)ReadAttributeLong(methodNode, "iflags") }; typedefEntry.Methods.Add(methodEntry); foreach (var pointNode in SelectChildNodes(methodNode, "pt")) { methodEntry.Blocks.Add(new MethodBlock { VisitCount = ReadAttributeInt(pointNode, "visit"), Offset = ReadAttributeInt(pointNode, "pos"), Length = ReadAttributeInt(pointNode, "len"), File = ReadAttributeInt(pointNode, "fid"), Start = new Position { Column = ReadAttributeInt(pointNode, "sc"), Line = ReadAttributeInt(pointNode, "sl") }, End = new Position { Column = ReadAttributeInt(pointNode, "ec"), Line = ReadAttributeInt(pointNode, "el") } }); } } } }
private static void AddMethodTreeNode(TreeNode classNode, MethodEntry md) { classNode.Nodes.Add(new MethodTreeNode(md)); }
public void Select(MethodEntry method) { rtbNodeProps.Rtf = string.Format(METHOD_INFO, method.Name, method.Signature, method.Flags, method.ImplFlags, method.BodySize); }
public void Select(MethodEntry method) { ShowMethodBlocks(method); }