Skip to content

Commit

Permalink
deodex refactoring part 1
Browse files Browse the repository at this point in the history
Significantly simplified how instructions are handled in baksmali. Normal
disassembly seems to be working, deodexing definitely not.

git-svn-id: https://smali.googlecode.com/svn/trunk@561 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
  • Loading branch information
JesusFreke@JesusFreke.com authored and JesusFreke@JesusFreke.com committed Jan 12, 2010
1 parent 575bd4c commit b2e1e20
Show file tree
Hide file tree
Showing 48 changed files with 560 additions and 2,357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,30 +245,33 @@ private List<StringTemplate> getInstanceFields() {
}

private List<StringTemplate> getDirectMethods() {
List<StringTemplate> directMethods = new ArrayList<StringTemplate>();

if (classDataItem != null) {
for (ClassDataItem.EncodedMethod method: classDataItem.getDirectMethods()) {
AnnotationSetItem annotationSet = methodAnnotationsMap.get(method.method.getIndex());
AnnotationSetRefList parameterAnnotationList = parameterAnnotationsMap.get(method.method.getIndex());
directMethods.add(MethodDefinition.createTemplate(stg, method, annotationSet, parameterAnnotationList));
}
if (classDataItem == null) {
return null;
}

return directMethods;
return getTemplatesForMethods(classDataItem.getDirectMethods());
}

private List<StringTemplate> getVirtualMethods() {
List<StringTemplate> virtualMethods = new ArrayList<StringTemplate>();
if (classDataItem == null) {
return null;
}

if (classDataItem != null) {
for (ClassDataItem.EncodedMethod method: classDataItem.getVirtualMethods()) {
AnnotationSetItem annotationSet = methodAnnotationsMap.get(method.method.getIndex());
AnnotationSetRefList parameterAnnotationList = parameterAnnotationsMap.get(method.method.getIndex());
virtualMethods.add(MethodDefinition.createTemplate(stg, method, annotationSet, parameterAnnotationList));
}
return getTemplatesForMethods(classDataItem.getVirtualMethods());
}

private List<StringTemplate> getTemplatesForMethods(ClassDataItem.EncodedMethod[] methods) {
List<StringTemplate> methodTemplates = new ArrayList<StringTemplate>();

for (ClassDataItem.EncodedMethod method: methods) {
AnnotationSetItem annotationSet = methodAnnotationsMap.get(method.method.getIndex());
AnnotationSetRefList parameterAnnotationList = parameterAnnotationsMap.get(method.method.getIndex());

MethodDefinition methodDefinition = new MethodDefinition(stg, method);

methodTemplates.add(methodDefinition.createTemplate(annotationSet, parameterAnnotationList));
}

return virtualMethods;
return methodTemplates;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import java.util.Iterator;

public class ArrayDataMethodItem extends InstructionFormatMethodItem<ArrayDataPseudoInstruction> {
public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoInstruction> {
public ArrayDataMethodItem(CodeItem codeItem, int codeAddress, StringTemplateGroup stg,
ArrayDataPseudoInstruction instruction) {
super(codeItem, codeAddress, stg, instruction);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit b2e1e20

Please sign in to comment.