@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int itemType = dexFile.readUshort(out.getCursor()); out.annotate(2, "type = 0x%x: %s", itemType, ItemType.getItemTypeName(itemType)); out.annotate(2, "unused"); int size = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size = %d", size); int offset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "offset = 0x%x", offset); }
@Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringDataOffset = dexFile.readSmallUint(out.getCursor()); try { String stringValue = dexFile.getString(itemIndex); out.annotate(4, "string_data_item[0x%x]: \"%s\"", stringDataOffset, StringUtils.escapeString(stringValue)); return; } catch (Exception ex) { System.err.print("Error while resolving string value at index: "); System.err.print(itemIndex); ex.printStackTrace(System.err); } out.annotate(4, "string_id_item[0x%x]", stringDataOffset); } };
@Override public void annotateSection(@Nonnull AnnotatedBytes out) { out.moveTo(sectionOffset); int mapItemCount = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size = %d", mapItemCount); super.annotateSectionInner(out, mapItemCount); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int startOffset = out.getCursor(); int headerSize; out.annotate(4, "checksum"); out.annotate(20, "signature"); out.annotate(4, "file_size: %d", dexFile.readInt(out.getCursor())); headerSize = dexFile.readInt(out.getCursor()); out.annotate(4, "header_size: %d", headerSize); int endianTag = dexFile.readInt(out.getCursor()); out.annotate(4, "endian_tag: 0x%x (%s)", endianTag, getEndianText(endianTag)); out.annotate(4, "link_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "link_offset: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "map_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "string_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "string_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "type_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "type_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "proto_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "proto_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "field_ids_size: %d", dexFile.readInt(out.getCursor()));
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); EncodedValue.annotateEncodedArray(out, reader); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int size = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size = %d", size); for (int i=0; i<size; i++) { int annotationSetOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "annotation_set_item[0x%x]", annotationSetOffset); } }
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int visibility = dexFile.readUbyte(out.getCursor()); out.annotate(1, "visibility = %d: %s", visibility, getAnnotationVisibility(visibility)); DexReader reader = dexFile.readerAt(out.getCursor()); EncodedValue.annotateEncodedAnnotation(out, reader); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, StringIdItem.getReferenceAnnotation(dexFile, stringIndex)); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int size = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size: %d", size); for (int i=0; i<size; i++) { int typeIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, TypeIdItem.getReferenceAnnotation(dexFile, typeIndex)); } }
@Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int size = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size = %d", size); for (int i=0; i<size; i++) { int annotationOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, AnnotationItem.getReferenceAnnotation(dexFile, annotationOffset)); } }
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int shortyIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "shorty_idx = %s", StringIdItem.getReferenceAnnotation(dexFile, shortyIndex)); int returnTypeIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "return_type_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, returnTypeIndex)); int parametersOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "parameters_off = %s", TypeListItem.getReferenceAnnotation(dexFile, parametersOffset)); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int classIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "class_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, classIndex)); int typeIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "return_type_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, typeIndex)); int nameIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "name_idx = %s", StringIdItem.getReferenceAnnotation(dexFile, nameIndex)); } };
@Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int classIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "class_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, classIndex)); int protoIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "proto_idx = %s", ProtoIdItem.getReferenceAnnotation(dexFile, protoIndex)); int nameIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "name_idx = %s", StringIdItem.getReferenceAnnotation(dexFile, nameIndex)); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int shortyIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "shorty_idx = %s", StringIdItem.getReferenceAnnotation(dexFile, shortyIndex)); int returnTypeIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "return_type_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, returnTypeIndex)); int parametersOffset = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "parameters_off = %s", TypeListItem.getReferenceAnnotation(dexFile, parametersOffset)); } };
@Override public void annotateSection(@Nonnull AnnotatedBytes out) { out.moveTo(sectionOffset); int mapItemCount = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "size = %d", mapItemCount); super.annotateSectionInner(out, mapItemCount); } };
@Override protected void annotateItem(AnnotatedBytes out, int itemIndex, String itemIdentity) { int classIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "class_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, classIndex)); int typeIndex = dexFile.readUshort(out.getCursor()); out.annotate(2, "return_type_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, typeIndex)); int nameIndex = dexFile.readSmallUint(out.getCursor()); out.annotate(4, "name_idx = %s", StringIdItem.getReferenceAnnotation(dexFile, nameIndex)); } };
public static void annotateEncodedArray(@Nonnull AnnotatedBytes out, @Nonnull DexReader reader) { assert out.getCursor() == reader.getOffset(); int size = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "size: %d", size); for (int i=0; i<size; i++) { out.annotate(0, "element[%d]", i); out.indent(); annotateEncodedValue(out, reader); out.deindent(); } }
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } };
@Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } };
public static void annotateEncodedArray(@Nonnull AnnotatedBytes out, @Nonnull DexReader reader) { assert out.getCursor() == reader.getOffset(); int size = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "size: %d", size); for (int i=0; i<size; i++) { out.annotate(0, "element[%d]", i); out.indent(); annotateEncodedValue(out, reader); out.deindent(); } }