- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 719
Disassembling classfiles
First you have to get your soot installation running. An explanation can be found here.
Soot has two fundamental uses; it can be used as a stand-alone command line tool or as a Java compiler framework. As a command line tool, Soot can:
- dissassemble classfiles
- assemble classfiles
- optimize classfiles
As a Java compiler framework, soot can be used as a testbed for developing new optimizations. These new optimizations can then be added to the base set of optimizations invoked by the command line soot tool. The optimizations that can be added can either be applied to single classfiles or entire applications.
Soot accomplishes these myriad tasks by being able to process classfiles in a variety of different forms. Currently soot accepts code from the following sources:
- Java (bytecode and source code up to Java 7), including other languages that compile to Java bytecode, e.g. Scala
- Android bytecode
- Jimple intermediate representation
- Jasmin, a low-level intermediate representation.
and outputs any of its intermediate representations. By invoking Soot with the -help option, you can see the output formats:
java soot.Main --help
...
Output Options:
-f FORMAT -output-format FORMAT
Set output format for Soot 
J jimple                    Produce .jimple Files 
j jimp                      Produce .jimp (abbreviated Jimple) files 
S shimple                   Produce .shimple files 
s shimp                     Produce .shimp (abbreviated Shimple) files 
B baf                       Produce .baf files 
b                           Produce .b (abbreviated Baf) files 
G grimple                   Produce .grimple files 
g grimp                     Produce .grimp (abbreviated Grimp) files 
X xml                       Produce .xml Files 
dex                         Produce Dalvik Virtual Machine files 
n none                      Produce no output 
jasmin                      Produce .jasmin files 
c class (default)           Produce .class Files 
d dava                      Produce dava-decompiled .java files 
t template                  Produce .java files with Jimple templates. 
...
There are six intermediate representations currently being used in Soot: baf, jimple, shimple, grimp, jasmin, and classfiles. A brief explanation of each form follows:
- 
bafa streamlined representation of bytecode. Used to inspect Java bytecode as stack code, but in a much nicer form. Has two textual representations (one abbreviated (.b files), one full (.baf files).)
- 
jimpletyped 3-address code. A very convenient representation for performing optimizations and inspecting bytecode. Has two textual representations (.jimp files, and .jimple files.)
- 
shimplean SSA variation of jimple. Has two textual representations (.shimp files, and .shimple files.)
- 
grimpaggregated (with respect to expression trees) jimple. The best intermediate representation for inspecting dissassembled code. Has two textual representations (.grimp files, and .grimple files.)
- 
jasmina messy assembler format. Used mainly for debugging Soot. Jasmin files end with ".jasmin".
- 
classfilesthe original Java bytecode format. A binary (non-textual) representation. The usual .class files.
Also check out Soot's webpage.
NOTE: If you find any bugs in those tutorials (or other parts of Soot) please help us out by reporting them in our issue tracker.
- Home
- Getting Help
- Tutorials
- Reference Material
- General Notions
- Getting Started
- A Few Uses of Soot
- Using Soot as a Command-Line Tool
- Using the Soot Eclipse Plugin
- Using Soot as a Compiler Framework
- Building Soot
- Coding Conventions
- Contributing to Soot
- Updating the Soot Web Page
- Reporting Bugs
- Preparing a New Soot Release