# HG changeset patch # User Thinker K.F. Li # Date 1312957704 -28800 # Node ID 372009418896b18bc9375ff679320fb93462c52b # Parent 987fead83ce3bab91f1debd61628b4314a23964f Fix bug of redirect methodid for XXX_RANGE istructions diff -r 987fead83ce3 -r 372009418896 paraspace/injection.py --- a/paraspace/injection.py Wed Aug 10 14:04:02 2011 +0800 +++ b/paraspace/injection.py Wed Aug 10 14:28:24 2011 +0800 @@ -427,7 +427,7 @@ if methodidx not in methods_redir: return opcode, args - return opcode, (args[0], methodidx, args[2]) + return opcode, (args[0], methods_redir[methodidx], args[2]) return opcode, args new_op_vectors = [redirect(opcode, args) for opcode, args in op_vectors] diff -r 987fead83ce3 -r 372009418896 paraspace/tests/injection_test.py --- a/paraspace/tests/injection_test.py Wed Aug 10 14:04:02 2011 +0800 +++ b/paraspace/tests/injection_test.py Wed Aug 10 14:28:24 2011 +0800 @@ -646,6 +646,10 @@ method = hello_linked.find_method_idx(methodidx) blk = dexfile.DEXFile_linked.get_code_block_method(method) opvectors = decode_insn_blk(blk) + methodidx = opvectors[4][1][2] + saved_methodid0 = hello_linked.find_methodid_idx(methodidx) + methodidx = opvectors[12][1][1] + saved_methodid1 = hello_linked.find_methodid_idx(methodidx) pass pass @@ -673,6 +677,14 @@ method = hello_linked.find_method_idx(methodidx) blk = dexfile.DEXFile_linked.get_code_block_method(method) opvectors = decode_insn_blk(blk) + methodidx = opvectors[4][1][2] + new_methodid0 = hello_linked.find_methodid_idx(methodidx) + assert new_methodid0 is saved_methodid0 + methodidx = opvectors[12][1][1] + new_methodid1 = hello_linked.find_methodid_idx(methodidx) + assert saved_methodid1 in hello_linked.methodIds.items + assert new_methodid1 in hello_linked.methodIds.items + assert new_methodid1 is saved_methodid1 pass pass pass