1 19 20 25 26 27 28 29 30 31 32 package soot.coffi; 33 import soot.*; 34 35 import java.util.*; 36 import java.io.*; 37 import java.util.Vector ; 38 import soot.util.*; 39 40 44 public class method_info { 45 46 public int access_flags; 47 51 public int name_index; 52 56 public int descriptor_index; 57 58 public int attributes_count; 59 62 public attribute_info attributes[]; 63 64 67 public Code_attribute code_attr; 68 69 72 public Instruction instructions; 73 76 public CFG cfg; 77 78 public soot.SootMethod jmethod; 79 80 List instructionList; 81 82 86 public String toName(cp_info constant_pool[]) { 87 CONSTANT_Utf8_info ci; 88 ci = (CONSTANT_Utf8_info)(constant_pool[name_index]); 89 return ci.convert(); 90 } 91 92 96 Code_attribute locate_code_attribute() { 97 attribute_info ai; 98 int i; 99 100 for (i=0; i<attributes_count; i++) { 101 ai = attributes[i]; 102 if (ai instanceof Code_attribute) 103 return (Code_attribute)ai; 104 } 105 return null; 106 } 107 108 112 public String prototype(cp_info constant_pool[]) { 113 String access,rt,name,params; 114 Code_attribute c = locate_code_attribute(); 115 116 access = ClassFile.access_string(access_flags," "); 117 rt = ClassFile.parseMethodDesc_return(cp_info.getTypeDescr(constant_pool, 118 descriptor_index)); 119 name = toName(constant_pool); 120 params = ClassFile.parseMethodDesc_params(cp_info. 121 getTypeDescr(constant_pool, 122 descriptor_index)); 123 if (access.length()>0) 124 return access + " " + rt + " " + name + "(" + params + ")"; 125 return rt + " " + name + "(" + params + ")"; 126 } 127 128 133 void print(cp_info constant_pool[]) { 134 G.v().out.println(prototype(constant_pool)); 135 ByteCode.showCode(instructions,constant_pool); 136 } 137 } 138 | Popular Tags |