mirror of
https://github.com/revanced/smali.git
synced 2025-05-23 18:16:23 +02:00
Tweak how empty item references are formatted in the annotated dump
This commit is contained in:
parent
93ff1cab5b
commit
a2b3cfe5f2
@ -152,7 +152,7 @@ public class ClassDataItem {
|
||||
|
||||
int codeOffset = reader.readSmallUleb128();
|
||||
if (codeOffset == 0) {
|
||||
out.annotateTo(reader.getOffset(), "code_off = 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));
|
||||
|
@ -75,29 +75,26 @@ public class ClassDefItem {
|
||||
Joiner.on('|').join(AccessFlags.getAccessFlagsForClass(accessFlags)));
|
||||
|
||||
int superclassIndex = dexFile.readSmallUint(out.getCursor());
|
||||
out.annotate(4, "superclass_idx = %s", TypeIdItem.getReferenceAnnotation(dexFile, superclassIndex));
|
||||
out.annotate(4, "superclass_idx = %s",
|
||||
TypeIdItem.getOptionalReferenceAnnotation(dexFile, superclassIndex));
|
||||
|
||||
int interfacesOffset = dexFile.readSmallUint(out.getCursor());
|
||||
out.annotate(4, "interfaces_off = %s", TypeListItem.getReferenceAnnotation(dexFile, interfacesOffset));
|
||||
|
||||
int sourceFileIdx = dexFile.readOptionalUint(out.getCursor());
|
||||
if (sourceFileIdx == -1) {
|
||||
out.annotate(4, "source_file_idx = -1");
|
||||
} else {
|
||||
out.annotate(4, "source_file_idx = %s", StringIdItem.getReferenceAnnotation(dexFile,
|
||||
sourceFileIdx));
|
||||
}
|
||||
out.annotate(4, "source_file_idx = %s", StringIdItem.getOptionalReferenceAnnotation(dexFile,
|
||||
sourceFileIdx));
|
||||
|
||||
int annotationsOffset = dexFile.readSmallUint(out.getCursor());
|
||||
if (annotationsOffset == 0) {
|
||||
out.annotate(4, "annotations_off = 0");
|
||||
out.annotate(4, "annotations_off = annotations_directory_item[NO_OFFSET]");
|
||||
} else {
|
||||
out.annotate(4, "annotations_off = annotations_directory_item[0x%x]", annotationsOffset);
|
||||
}
|
||||
|
||||
int classDataOffset = dexFile.readSmallUint(out.getCursor());
|
||||
if (classDataOffset == 0) {
|
||||
out.annotate(4, "class_data_off = 0");
|
||||
out.annotate(4, "class_data_off = class_data_item[NO_OFFSET]");
|
||||
} else {
|
||||
out.annotate(4, "class_data_off = class_data_item[0x%x]", classDataOffset);
|
||||
addClassDataIdentity(classDataOffset, dexFile.getType(classIndex));
|
||||
@ -105,7 +102,7 @@ public class ClassDefItem {
|
||||
|
||||
int staticValuesOffset = dexFile.readSmallUint(out.getCursor());
|
||||
if (staticValuesOffset == 0) {
|
||||
out.annotate(4, "static_values_off = 0");
|
||||
out.annotate(4, "static_values_off = encoded_array_item[NO_OFFSET]");
|
||||
} else {
|
||||
out.annotate(4, "static_values_off = encoded_array_item[0x%x]", staticValuesOffset);
|
||||
}
|
||||
|
@ -86,4 +86,19 @@ public class StringIdItem {
|
||||
}
|
||||
return String.format("string_id_item[%d]", stringIndex);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
public static String getOptionalReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex) {
|
||||
return getOptionalReferenceAnnotation(dexFile, stringIndex, false);
|
||||
|
||||
}
|
||||
|
||||
public static String getOptionalReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex,
|
||||
boolean quote) {
|
||||
if (stringIndex == -1) {
|
||||
return "string_id_item[NO_INDEX]";
|
||||
}
|
||||
return getReferenceAnnotation(dexFile, stringIndex, quote);
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +66,12 @@ public class TypeIdItem {
|
||||
}
|
||||
return String.format("type_id_item[%d]", typeIndex);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getOptionalReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int typeIndex) {
|
||||
if (typeIndex == -1) {
|
||||
return "type_id_item[NO_INDEX]";
|
||||
}
|
||||
return getReferenceAnnotation(dexFile, typeIndex);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class TypeListItem {
|
||||
@Nonnull
|
||||
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int typeListOffset) {
|
||||
if (typeListOffset == 0) {
|
||||
return "0";
|
||||
return "type_list_item[NO_OFFSET]";
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user