public void decodeInsns(Code mthCode) throws DecodeException { short[] encodedInstructions = mthCode.getInstructions(); int size = encodedInstructions.length; DecodedInstruction[] decoded = new DecodedInstruction[size]; ShortArrayCodeInput in = new ShortArrayCodeInput(encodedInstructions); try { while (in.hasMore()) { decoded[in.cursor()] = decodeRawInsn(in); } } catch (Exception e) { throw new DecodeException(method, e.getMessage(), e); } insnArr = decoded; }
public void test(Code mthCode) throws DecodeException { short[] encodedInstructions = mthCode.getInstructions(); int size = encodedInstructions.length; DecodedInstruction[] decoded = new DecodedInstruction[size]; ShortArrayCodeInput in = new ShortArrayCodeInput(encodedInstructions); try { while (in.hasMore()) { decoded[in.cursor()] = DecodedInstruction.decode(in); } } catch (EOFException e) { throw new DecodeException(method, "", e); } insnArr = decoded; } }
codeReader.visitAll(dex.readCode(method).getInstructions());
codeReader.visitAll(dex.readCode(method).getInstructions());
codeReader.visitAll(dex.readCode(method).getInstructions());
/** * Prints usages to out. Returns the number of matches found. */ public int grep() { for (ClassDef classDef : dex.classDefs()) { currentClass = classDef; currentMethod = null; if (classDef.getClassDataOffset() == 0) { continue; } ClassData classData = dex.readClassData(classDef); // find the strings in encoded constants int staticValuesOffset = classDef.getStaticValuesOffset(); if (staticValuesOffset != 0) { readArray(new EncodedValueReader(dex.open(staticValuesOffset))); } // find the strings in method bodies for (ClassData.Method method : classData.allMethods()) { currentMethod = method; if (method.getCodeOffset() != 0) { codeReader.visitAll(dex.readCode(method).getInstructions()); } } } currentClass = null; currentMethod = null; return count; }
/** * Prints usages to out. Returns the number of matches found. */ public int grep() { for (ClassDef classDef : dex.classDefs()) { currentClass = classDef; currentMethod = null; if (classDef.getClassDataOffset() == 0) { continue; } ClassData classData = dex.readClassData(classDef); // find the strings in encoded constants int staticValuesOffset = classDef.getStaticValuesOffset(); if (staticValuesOffset != 0) { readArray(new EncodedValueReader(dex.open(staticValuesOffset))); } // find the strings in method bodies for (ClassData.Method method : classData.allMethods()) { currentMethod = method; if (method.getCodeOffset() != 0) { codeReader.visitAll(dex.readCode(method).getInstructions()); } } } currentClass = null; currentMethod = null; return count; }
/** * Prints usages to out. Returns the number of matches found. */ public int grep() { for (ClassDef classDef : dex.classDefs()) { currentClass = classDef; currentMethod = null; if (classDef.getClassDataOffset() == 0) { continue; } ClassData classData = dex.readClassData(classDef); // find the strings in encoded constants int staticValuesOffset = classDef.getStaticValuesOffset(); if (staticValuesOffset != 0) { readArray(new EncodedValueReader(dex.open(staticValuesOffset))); } // find the strings in method bodies for (ClassData.Method method : classData.allMethods()) { currentMethod = method; if (method.getCodeOffset() != 0) { codeReader.visitAll(dex.readCode(method).getInstructions()); } } } currentClass = null; currentMethod = null; return count; }
short[] instructions = code.getInstructions(); short[] newInstructions = instructionTransformer.transform(indexMap, instructions); codeOut.writeInt(newInstructions.length);
short[] instructions = code.getInstructions(); short[] newInstructions = instructionTransformer.transform(indexMap, instructions); codeOut.writeInt(newInstructions.length);
short[] instructions = code.getInstructions(); InstructionTransformer transformer = (in == dexA) ? aInstructionTransformer