cuplv / TraceRunner

Tool for generating dynamic traces of android applications.
3 stars 0 forks source link

NPE when running instrument.sh on any test apps. #29

Closed Pezhin closed 7 years ago

Pezhin commented 7 years ago

The command I am using: bash instrument.sh autoTracer/test/app-debug.apk output /Users/Pezh/Library/Android/sdk/platforms where:

The log I got is long so I cut some of it, if you need the full log, let me know

Application APK file: autoTracer/test/app-debug.apk
Output Path: /Users/Pezh/Desktop/DLA/TraceRunner/autoTracer/output
Output APK: /Users/Pezh/Desktop/DLA/TraceRunner/autoTracer/output/app-debug.apk
TraceRunner Path: /Users/Pezh/Desktop/DLA/TraceRunner
Instrumentation Jar Path: /Users/Pezh/Desktop/DLA/TraceRunner/TraceRunnerRuntimeInstrumentation/tracerunnerinstrumentation/build/intermediates/bundles/debug/classes.jar
Instrumentation Dex Path: /Users/Pezh/Desktop/DLA/TraceRunner/TraceRunnerRuntimeInstrumentation/app/build/intermediates/transforms/dex/debug/folders/1000/1f/main/classes.dex
[info] Set current project to tracerunner (in build file:/Users/Pezh/Desktop/DLA/TraceRunner/)
[info] Running edu.colorad.cs.TraceRunner.TraceRunner -d autoTracer/test/app-debug.apk -j /Users/Pezh/Library/Android/sdk/platforms -o /Users/Pezh/Desktop/DLA/TraceRunner/autoTracer/output -i /Users/Pezh/Desktop/DLA/TraceRunner/TraceRunnerRuntimeInstrumentation/tracerunnerinstrumentation/build/intermediates/bundles/debug/classes.jar
Soot started on Wed Feb 08 13:29:58 MST 2017
Warning: javax.crypto.Cipher is a phantom class!
-----------------------------
/** cut the warning part **/
-----------------------------
Warning: org.json.JSONObject is a phantom class!
Warning: org.json.JSONArray is a phantom class!
java.lang.NullPointerException
    at edu.colorado.OverrideAllMethods.getOverrideableMethodsChain(OverrideAllMethods.scala:139)
    at edu.colorado.OverrideAllMethods.getOverrideableMethodsChain(OverrideAllMethods.scala:141)
    at edu.colorado.OverrideAllMethods.getOverrideableMethodsChain(OverrideAllMethods.scala:141)
    at edu.colorado.OverrideAllMethods$$anonfun$internalTransform$1.apply(OverrideAllMethods.scala:33)
    at edu.colorado.OverrideAllMethods$$anonfun$internalTransform$1.apply(OverrideAllMethods.scala:29)
    at scala.collection.Iterator$class.foreach(Iterator.scala:893)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
    at edu.colorado.OverrideAllMethods.internalTransform(OverrideAllMethods.scala:29)
    at soot.SceneTransformer.transform(SceneTransformer.java:39)
    at soot.Transform.apply(Transform.java:90)
    at soot.ScenePack.internalApply(ScenePack.java:40)
    at soot.Pack.apply(Pack.java:118)
    at soot.PackManager.runWholeProgramPacks(PackManager.java:579)
    at soot.PackManager.runPacksNormally(PackManager.java:469)
    at soot.PackManager.runPacks(PackManager.java:398)
    at soot.Main.run(Main.java:271)
    at soot.Main.main(Main.java:147)
    at edu.colorad.cs.TraceRunner.TraceRunner$.main(TraceRunner.scala:118)
    at edu.colorad.cs.TraceRunner.TraceRunner.main(TraceRunner.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sbt.Run.invokeMain(Run.scala:67)
    at sbt.Run.run0(Run.scala:61)
    at sbt.Run.sbt$Run$$execute$1(Run.scala:51)
    at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55)
    at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
    at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
    at sbt.Logger$$anon$4.apply(Logger.scala:85)
    at sbt.TrapExit$App.run(TrapExit.scala:248)
    at java.lang.Thread.run(Thread.java:745)

Ouuups... something went wrong! Sorry about that.
Follow these steps to fix the problem:
1.) Are you sure you used the right command line?
    Click here to double-check:
    https://ssebuild.cased.de/nightly/soot/doc/soot_options.htm

2.) Not sure whether it's a bug? Feel free to discuss
    the issue on the Soot mailing list:
    https://github.com/Sable/soot/wiki/Getting-help

3.) Sure it's a bug? Click this link to report it.
ftc commented 7 years ago

Could you set a conditional breakpoint (for clazz == null) at line 139 of OverrideAllMethods.java and give me the runtime value of the variable "superclass" by traversing up the stack in the debugger until you get to line 33 of OverrideAllMethods.java?

This looks like soot is loading in a malformed class hierarchy. The class in "superclass" on the above mentioned line will show where it is coming from. The solution will probably be to remove a malformed Android jar from your SDK directory or recompile the instrumentation code.

ftc commented 7 years ago

Another thing to look at is see if it is resolving the correct Java runtime library. It may not be pulling in the "java.lang.Object" class.

ftc commented 7 years ago

@Pezhin can you let me know if this is fixed?

Pezhin commented 7 years ago

@ftc: Sorry I haven't got a chance to do this recently, Let me try it on weekends and get back to you later

Pezhin commented 7 years ago

This is the superclass value img

This lineif(clazz.getName != "java.lang.Object") the value of clazz is "java.lang.Object" -> "java.lang.Object" -> "android.app.Fragment" -> "null"

ftc commented 7 years ago

@Pezhin if you are still needing to use this I have fixed the issue on the develop branch.