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; }
case ValueType.FIELD: int fieldIndex = reader.readSizedSmallUint(valueArg+1); return FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex); case ValueType.METHOD: int methodIndex = reader.readSizedSmallUint(valueArg+1); case ValueType.ENUM: fieldIndex = reader.readSizedSmallUint(valueArg+1); return FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex); case ValueType.ARRAY: case ValueType.ANNOTATION:
case ValueType.FIELD: int fieldIndex = reader.readSizedSmallUint(valueArg+1); return FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex); case ValueType.METHOD: int methodIndex = reader.readSizedSmallUint(valueArg+1); case ValueType.ENUM: fieldIndex = reader.readSizedSmallUint(valueArg+1); return FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex); case ValueType.ARRAY: case ValueType.ANNOTATION:
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int methodHandleType = dexFile.readUshort(out.getCursor()); out.annotate(2, "type = %s", MethodHandleType.toString(methodHandleType)); out.annotate(2, "unused"); int fieldOrMethodId = dexFile.readUshort(out.getCursor()); String fieldOrMethodDescriptor; switch (methodHandleType) { case MethodHandleType.STATIC_PUT: case MethodHandleType.STATIC_GET: case MethodHandleType.INSTANCE_PUT: case MethodHandleType.INSTANCE_GET: fieldOrMethodDescriptor = FieldIdItem.getReferenceAnnotation(dexFile, fieldOrMethodId); break; case MethodHandleType.INVOKE_STATIC: case MethodHandleType.INVOKE_INSTANCE: case MethodHandleType.INVOKE_CONSTRUCTOR: case MethodHandleType.INVOKE_DIRECT: case MethodHandleType.INVOKE_INTERFACE: fieldOrMethodDescriptor = MethodIdItem.getReferenceAnnotation(dexFile, fieldOrMethodId); break; default: throw new ExceptionWithContext("Invalid method handle type: %d", methodHandleType); } out.annotate(2, "field_or_method_id = %s", fieldOrMethodDescriptor); out.annotate(2, "unused"); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int methodHandleType = dexFile.readUshort(out.getCursor()); out.annotate(2, "type = %s", MethodHandleType.toString(methodHandleType)); out.annotate(2, "unused"); int fieldOrMethodId = dexFile.readUshort(out.getCursor()); String fieldOrMethodDescriptor; switch (methodHandleType) { case MethodHandleType.STATIC_PUT: case MethodHandleType.STATIC_GET: case MethodHandleType.INSTANCE_PUT: case MethodHandleType.INSTANCE_GET: fieldOrMethodDescriptor = FieldIdItem.getReferenceAnnotation(dexFile, fieldOrMethodId); break; case MethodHandleType.INVOKE_STATIC: case MethodHandleType.INVOKE_INSTANCE: case MethodHandleType.INVOKE_CONSTRUCTOR: case MethodHandleType.INVOKE_DIRECT: case MethodHandleType.INVOKE_INTERFACE: fieldOrMethodDescriptor = MethodIdItem.getReferenceAnnotation(dexFile, fieldOrMethodId); break; default: throw new ExceptionWithContext("Invalid method handle type: %d", methodHandleType); } out.annotate(2, "field_or_method_id = %s", fieldOrMethodDescriptor); out.annotate(2, "unused"); } };
out.annotate(1, "valueArg = %d, valueType = 0x%x: field", valueArg, valueType); int fieldIndex = reader.readSizedSmallUint(valueArg+1); out.annotate(valueArg+1, "value = %s", FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex)); break; case 0x1a: out.annotate(1, "valueArg = %d, valueType = 0x%x: enum", valueArg, valueType); fieldIndex = reader.readSizedSmallUint(valueArg+1); out.annotate(valueArg+1, "value = %s", FieldIdItem.getReferenceAnnotation(reader.dexBuf, fieldIndex)); break; case 0x1c:
out.indent(); int fieldIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int annotationOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", AnnotationSetItem.getReferenceAnnotation(dexFile, annotationOffset));
out.indent(); int fieldIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int annotationOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", AnnotationSetItem.getReferenceAnnotation(dexFile, annotationOffset));
out.indent(); int fieldIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", FieldIdItem.getReferenceAnnotation(dexFile, fieldIndex)); int annotationOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "%s", AnnotationSetItem.getReferenceAnnotation(dexFile, annotationOffset));