changeset 138:372009418896

Fix bug of redirect methodid for XXX_RANGE istructions
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 10 Aug 2011 14:28:24 +0800
parents 987fead83ce3
children 0704e23009e4
files paraspace/injection.py paraspace/tests/injection_test.py
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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]
--- 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