Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Sable/soot into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenArzt committed Jan 14, 2014
2 parents 2ef48b6 + 5843f1a commit 62d066d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/soot/dexpler/DexClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import soot.Type;
import soot.javaToJimple.IInitialResolver.Dependencies;
import soot.options.Options;
import soot.tagkit.SourceFileTag;

/**
* DexClass is a container for all relevant information of that class
Expand Down Expand Up @@ -74,6 +75,10 @@ public static Dependencies makeSootClass(SootClass sc, ClassDef defItem, DexFile
String superClass = defItem.getSuperclass();
Dependencies deps = new Dependencies();

// source file
String sourceFile = defItem.getSourceFile();
sc.addTag(new SourceFileTag(sourceFile));

// super class for hierarchy level
String superClassName = Util.dottedClassName(superClass);
SootClass sootSuperClass = SootResolver.v().makeClassRef(superClassName);
Expand Down
3 changes: 2 additions & 1 deletion src/soot/dexpler/DexResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public Dependencies resolveFromFile(File file, String className, SootClass sc) {
protected static void addSourceFileTag(SootClass sc, String fileName){
soot.tagkit.SourceFileTag tag = null;
if (sc.hasTag("SourceFileTag")) {
tag = (soot.tagkit.SourceFileTag)sc.getTag("SourceFileTag");
return; // do not add tag if original class already has debug
// information
}
else {
tag = new soot.tagkit.SourceFileTag();
Expand Down
11 changes: 10 additions & 1 deletion src/soot/toDex/DexPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import soot.jimple.toolkits.scalar.EmptySwitchEliminator;
import soot.options.Options;
import soot.tagkit.LineNumberTag;
import soot.tagkit.SourceFileTag;
import soot.tagkit.Tag;

/**
Expand Down Expand Up @@ -203,7 +204,15 @@ private void addAsClassDefItem(SootClass c) {
ClassDataItem classData = toClassDataItem(c, dexFile);
AnnotationDirectoryItem di= dexAnnotation.finish();
// staticFieldInitializers is not used since the <clinit> method should be enough
ClassDefItem.internClassDefItem(dexFile, classType, accessFlags, superType, implementedInterfaces, null, di, classData, null);
// add source file tag if any
StringIdItem sourceFileItem = null;
if (c.hasTag("SourceFileTag")) {
SourceFileTag sft = (SourceFileTag) c.getTag("SourceFileTag");
String sourceFile = sft.getSourceFile();
sourceFileItem = StringIdItem.internStringIdItem(dexFile, sourceFile);
}
ClassDefItem.internClassDefItem(dexFile, classType, accessFlags, superType,
implementedInterfaces, sourceFileItem, di, classData, null);
dexAnnotation = null;
}

Expand Down

0 comments on commit 62d066d

Please sign in to comment.