comparison paraspace/tests/injection_test.py @ 107:4b3573d039af

Fix bug of DEXFile_linked.find_method_name_proto(). - It miss understood structure of _DEX_Method to get associated _DEX_ProtoId.
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 30 Jul 2011 22:59:09 +0800
parents 7821c6e89622
children 835336632aba
comparison
equal deleted inserted replaced
106:7821c6e89622 107:4b3573d039af
138 138
139 fakefile_def = \ 139 fakefile_def = \
140 fakefile_linked.find_class_name('Lcom/codemud/fakefile/fakefile;') 140 fakefile_linked.find_class_name('Lcom/codemud/fakefile/fakefile;')
141 clone = dexfile_insert_class(helloworld_linked, fakefile_def) 141 clone = dexfile_insert_class(helloworld_linked, fakefile_def)
142 142
143 init_method = fakefile_linked.find_method_name('<init>', fakefile_def)
144 init_protoid = init_method.methodIdx.protoIdx
145
143 File_typeid = helloworld_linked.find_typeid_name('Ljava/io/File;') 146 File_typeid = helloworld_linked.find_typeid_name('Ljava/io/File;')
144 assert File_typeid 147 assert File_typeid
145 File_typeidx = helloworld_linked.get_idx_typeid(File_typeid) 148 File_typeidx = helloworld_linked.get_idx_typeid(File_typeid)
146 149
147 clone_typeidx = helloworld_linked.get_idx_typeid(clone.classIdx) 150 clone_typeidx = helloworld_linked.get_idx_typeid(clone.classIdx)
161 if opcode == dalvik_opcodes.all_opcodes.OP_NEW_INSTANCE: 164 if opcode == dalvik_opcodes.all_opcodes.OP_NEW_INSTANCE:
162 assert args[1] != File_typeidx 165 assert args[1] != File_typeidx
163 pass 166 pass
164 elif opcode == dalvik_opcodes.all_opcodes.OP_INVOKE_DIRECT: 167 elif opcode == dalvik_opcodes.all_opcodes.OP_INVOKE_DIRECT:
165 methodid = helloworld_linked.find_methodid_idx(args[2]) 168 methodid = helloworld_linked.find_methodid_idx(args[2])
166 print fakefile_codes, code, args[2]
167 assert methodid.classIdx != File_typeid or \ 169 assert methodid.classIdx != File_typeid or \
168 code in fakefile_codes 170 code in fakefile_codes
169 pass 171 pass
170 pass 172 pass
171 pass 173 pass