notishell / smali

Automatically exported from code.google.com/p/smali
0 stars 0 forks source link

smali/baksmali supports only single invocation #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What seems to be the problem?
It is not easy to reuse baksmali without restarting the JVM. It seems to be 
designed to run only once and then terminate.

What is the exact smali/baksmali command that you ran?
I try to baksmali two separate apk's in a single JVM execution by invoking 
baksmali.main(). I get an exception on the second invocation. It is also 
impossible to run baksmali in an app. server-like environment.

What version of smali/baksmali are you using? What rom are you working
from?
1.3.3-dev

Please provide any additional information below: error messages, symptoms,
etc.

I see an opportunity for improvement in smali/baksmali code.

Original issue reported on code.google.com by rustam...@gmail.com on 21 Apr 2012 at 9:43

GoogleCodeExporter commented 9 years ago
You're right, that wasn't a goal when I was writing the code. I'm curious what 
exception you are getting? I doubt it would be too hard to fix it so that this 
use case is possible.

Original comment by jesusfreke@jesusfreke.com on 21 Apr 2012 at 9:54

GoogleCodeExporter commented 9 years ago
Here's the error I'm getting:

org.jf.dexlib.Util.ExceptionWithContext: Cannot initialize ClassPath multiple 
times
    at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPathFromOdex(ClassPath.java:79)
    at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:104)
    at org.jf.baksmali.main.main(main.java:293)

Original comment by rustam...@gmail.com on 25 Apr 2012 at 2:08

GoogleCodeExporter commented 9 years ago
Ah, gotcha. That shouldn't be too hard to fix.

Original comment by jesusfreke@jesusfreke.com on 25 Apr 2012 at 5:02

GoogleCodeExporter commented 9 years ago
It would be really nice if there was an API to smali/baksmali, so that I won't 
need to invoke the main() method and simulate command-line invocation, because 
in addition to having to simulate the command line, there is also an issue with 
System.exit() killing the whole JVM in case of an error :|

Original comment by rustam...@gmail.com on 26 Apr 2012 at 10:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have examined the code of smali - and it appears that the code is not Thread 
Safe - i.e, you cannot decompile two dex files at the same time. 

Original comment by oba2c...@gmail.com on 18 Mar 2013 at 1:52

GoogleCodeExporter commented 9 years ago
That is correct :)

This should be considerably improved with the new dexlib2

Original comment by bgruv@google.com on 18 Mar 2013 at 6:59

GoogleCodeExporter commented 9 years ago
Currently smali is thread safe, and it should be safe to invoke multiple 
instances of baksmali in the same process. But it's not quite thread-safe to 
disassemble multiple classes concurrently using multiple threads in a single 
instance of baksmali.

Original comment by jesusfreke@jesusfreke.com on 7 May 2013 at 8:17

GoogleCodeExporter commented 9 years ago
By "currently", I mean in the new 2.0 release (currently in beta)

Original comment by jesusfreke@jesusfreke.com on 7 May 2013 at 8:17

GoogleCodeExporter commented 9 years ago
Great, thanks! will try out when I get a chance!

Original comment by rustam...@gmail.com on 7 May 2013 at 8:30