public void ScanMethodBody(string app, MethodDefinition methd, ICollection filters) { if (methd.Body == null) { return; } Collectors.OnMethodBody(methd.Body); foreach (Mono.Cecil.Cil.Instruction i in methd.Body.Instructions) { if (CodeProperties.IsMethodCall(i)) { //if (i.Operand is Mono.Cecil.CallSite || i.Operand is Mono.Cecil.FieldReference) // continue; MethodReference rf = (MethodReference)i.Operand; string typeName = CodeProperties.GetClassName(rf.DeclaringType); string methName = CodeProperties.GetMethodNameWithParameters(((MethodReference)i.Operand)); if (filters.Count > 0) { if (IsIncluded(filters, typeName)) { ProcessMethod(methd, rf, typeName, methName); } } else { ProcessMethod(methd, rf, typeName, methName); } } } }
private ArrayList GetSystemCallSequences(MethodBody body) { ArrayList list = new ArrayList(); string last = ""; foreach (Instruction i in body.Instructions) { if (CodeProperties.IsMethodCall(i)) { MethodReference rf = (MethodReference)i.Operand; if (CodeProperties.IsSystem(rf)) { string full = CodeProperties.GetFullName(rf); if (/*last != full &&*/ !Stop(full)) { list.Add(full); } //last = full; } } } return(list); }