public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex) { this.dexFile = reader.dexBuf; this.classDef = classDef; startOffset = reader.getOffset(); // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); this.codeOffset = reader.readSmallUleb128(); this.methodAnnotationSetOffset = 0; this.parameterAnnotationSetListOffset = 0; }
public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex, @Nonnull AnnotationsDirectory.AnnotationIterator methodAnnotationIterator, @Nonnull AnnotationsDirectory.AnnotationIterator paramaterAnnotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; startOffset = reader.getOffset(); // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); this.codeOffset = reader.readSmallUleb128(); this.methodAnnotationSetOffset = methodAnnotationIterator.seekTo(methodIndex); this.parameterAnnotationSetListOffset = paramaterAnnotationIterator.seekTo(methodIndex); }
/** * Calculate and return the private size of a method definition. * * Calculated as: method_idx_diff + access_flags + code_off + * implementation size + reference size * * @return size in bytes */ public int getSize() { int size = 0; DexReader reader = dexFile.readerAt(startOffset); reader.readLargeUleb128(); //method_idx_diff reader.readSmallUleb128(); //access_flags reader.readSmallUleb128(); //code_off size += reader.getOffset() - startOffset; DexBackedMethodImplementation impl = getImplementation(); if (impl != null) { size += impl.getSize(); } DexBackedMethodReference methodRef = new DexBackedMethodReference(dexFile, methodIndex); size += methodRef.getSize(); return size; } }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); this.initialValue = null; }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull StaticInitialValueIterator staticInitialValueIterator, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); this.initialValue = staticInitialValueIterator.getNextOrNull(); }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = 0; this.initialValue = null; }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = 0; this.initialValue = null; }
public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex) { this.dexFile = reader.dexBuf; this.classDef = classDef; startOffset = reader.getOffset(); // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); this.codeOffset = reader.readSmallUleb128(); this.methodAnnotationSetOffset = 0; this.parameterAnnotationSetListOffset = 0; }
public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); this.codeOffset = reader.readSmallUleb128(); Logger.log("the codeoffset :" +this.codeOffset); this.methodAnnotationSetOffset = 0; this.parameterAnnotationSetListOffset = 0; }
public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex, @Nonnull AnnotationsDirectory.AnnotationIterator methodAnnotationIterator, @Nonnull AnnotationsDirectory.AnnotationIterator paramaterAnnotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); //undo this data is error, the code this.codeOffset = reader.readSmallUleb128(); //end this.methodAnnotationSetOffset = methodAnnotationIterator.seekTo(methodIndex); this.parameterAnnotationSetListOffset = paramaterAnnotationIterator.seekTo(methodIndex); }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull EncodedArrayItemIterator staticInitialValueIterator, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = staticInitialValueIterator.getReaderOffset(); this.initialValue = staticInitialValueIterator.getNextOrNull(); }
private int annotateEncodedField(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int fieldIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "field_idx_diff = %d: %s", indexDelta, FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForField(accessFlags))); return fieldIndex; }
private int annotateEncodedField(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int fieldIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "field_idx_diff = %d: %s", indexDelta, FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForField(accessFlags))); return fieldIndex; }
private int annotateEncodedField(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int fieldIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "field_idx_diff = %d: %s", indexDelta, FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForField(accessFlags))); return fieldIndex; }
public DexBackedMethod(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex, @Nonnull AnnotationsDirectory.AnnotationIterator methodAnnotationIterator, @Nonnull AnnotationsDirectory.AnnotationIterator paramaterAnnotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; startOffset = reader.getOffset(); // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int methodIndexDiff = reader.readLargeUleb128(); this.methodIndex = methodIndexDiff + previousMethodIndex; this.accessFlags = reader.readSmallUleb128(); this.codeOffset = reader.readSmallUleb128(); this.methodAnnotationSetOffset = methodAnnotationIterator.seekTo(methodIndex); this.parameterAnnotationSetListOffset = paramaterAnnotationIterator.seekTo(methodIndex); }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull EncodedArrayItemIterator staticInitialValueIterator, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = staticInitialValueIterator.getReaderOffset(); this.initialValue = staticInitialValueIterator.getNextOrNull(); }
private int annotateEncodedMethod(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int methodIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "method_idx_diff = %d: %s", indexDelta, MethodIdItem.getReferenceAnnotation(dexFile, methodIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForMethod(accessFlags))); int codeOffset = reader.readSmallUleb128(); if (codeOffset == 0) { out.annotateTo(reader.getOffset(), "code_off = code_item[NO_OFFSET]"); } else { out.annotateTo(reader.getOffset(), "code_off = code_item[0x%x]", codeOffset); addCodeItemIdentity(codeOffset, MethodIdItem.asString(dexFile, methodIndex)); } return methodIndex; }
private int annotateEncodedMethod(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int methodIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "method_idx_diff = %d: %s", indexDelta, MethodIdItem.getReferenceAnnotation(dexFile, methodIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForMethod(accessFlags))); int codeOffset = reader.readSmallUleb128(); if (codeOffset == 0) { out.annotateTo(reader.getOffset(), "code_off = code_item[NO_OFFSET]"); } else { out.annotateTo(reader.getOffset(), "code_off = code_item[0x%x]", codeOffset); addCodeItemIdentity(codeOffset, MethodIdItem.asString(dexFile, methodIndex)); } return methodIndex; }
private int annotateEncodedMethod(@Nonnull AnnotatedBytes out, @Nonnull RawDexFile dexFile, @Nonnull DexReader reader, int previousIndex) { // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. int indexDelta = reader.readLargeUleb128(); int methodIndex = previousIndex + indexDelta; out.annotateTo(reader.getOffset(), "method_idx_diff = %d: %s", indexDelta, MethodIdItem.getReferenceAnnotation(dexFile, methodIndex)); int accessFlags = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "access_flags = 0x%x: %s", accessFlags, Joiner.on('|').join(AccessFlags.getAccessFlagsForMethod(accessFlags))); int codeOffset = reader.readSmallUleb128(); if (codeOffset == 0) { out.annotateTo(reader.getOffset(), "code_off = code_item[NO_OFFSET]"); } else { out.annotateTo(reader.getOffset(), "code_off = code_item[0x%x]", codeOffset); addCodeItemIdentity(codeOffset, MethodIdItem.asString(dexFile, methodIndex)); } return methodIndex; }
/** * Calculate and return the private size of a method definition. * * Calculated as: method_idx_diff + access_flags + code_off + * implementation size + reference size * * @return size in bytes */ public int getSize() { int size = 0; DexReader reader = dexFile.readerAt(startOffset); reader.readLargeUleb128(); //method_idx_diff reader.readSmallUleb128(); //access_flags reader.readSmallUleb128(); //code_off size += reader.getOffset() - startOffset; DexBackedMethodImplementation impl = getImplementation(); if (impl != null) { size += impl.getSize(); } DexBackedMethodReference methodRef = new DexBackedMethodReference(dexFile, methodIndex); size += methodRef.getSize(); return size; } }