From cbc21d5ece82734c479ae52d8f7fa91baf2281e9 Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Sat, 6 Mar 2010 06:12:03 +0000 Subject: [PATCH] Don't forget to replace un-deodexable instructions git-svn-id: https://smali.googlecode.com/svn/trunk@671 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../dexlib/Code/Analysis/MethodAnalyzer.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java index 0b28dde0..00647b90 100644 --- a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java +++ b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java @@ -233,6 +233,32 @@ public class MethodAnalyzer { } } while (true); + + for (int i=odexedInstructions.nextSetBit(0); i>=0; i=odexedInstructions.nextSetBit(i+1)) { + AnalyzedInstruction instruction = instructions.valueAt(i); + + Instruction odexedInstruction = instruction.instruction; + int objectRegisterNumber; + + if (odexedInstruction.getFormat() == Format.Format22cs) { + objectRegisterNumber = ((Instruction22cs)odexedInstruction).getRegisterB(); + } else if (odexedInstruction.getFormat() == Format.Format35ms) { + objectRegisterNumber = ((Instruction35ms)odexedInstruction).getRegisterD(); + } else if (odexedInstruction.getFormat() == Format.Format3rms) { + objectRegisterNumber = ((Instruction3rms)odexedInstruction).getStartRegister(); + } else { + assert false; + throw new ExceptionWithContext(String.format("Unexpected format %s for odexed instruction", + odexedInstruction.getFormat().name())); + } + + instruction.setDeodexedInstruction(new UnresolvedNullReference(odexedInstruction, + objectRegisterNumber)); + + setAndPropagateDeadness(instruction); + } + + analyzerState = ANALYZED; }