Are you ready to dive into the world of static program analysis using Soot? In this tutorial, we’ll explore the essential elements of Soot and guide you through some practical examples to help you understand static analysis better. So grab your favorite Java IDE and let’s get started!
Who This Tutorial Is For
This tutorial is aimed at anyone familiar with Java programming who wants to delve into static analysis but is new to Soot. If you have some previous knowledge about static program analysis, you might want to look for more advanced resources here.
Setting Up Soot
Before we jump into analysis, we need to configure our environment. Follow these simple steps to set up:
- Ensure you have Java 8 installed on your system.
- Navigate to your project directory in the terminal.
- Run the command:
.gradlew build
For more comprehensive installation and Docker setup instructions, follow this link.
Chapter Breakdown
Now that you are set up, let’s explore the chapters of this tutorial where we will work through various analysis tasks:
1: Get Your Hands Dirty
In this chapter, you’ll get acquainted with Soot’s essential data structures and Jimple, its core intermediate representation. Here’s how you can start:
- Run:
.gradlew run --args=HelloSootto view the Jimple representation of the printFizzBuzz method along with the branch statement. - Run:
.gradlew run --args=HelloSoot drawto visualize the control-flow graph.
2: Know the Basic APIs
This chapter introduces you to important Soot methods that help read, analyze, and modify Java code. To get started:
- Run:
.gradlew run --args=BasicAPIto analyze the class Circle. - Run:
.gradlew run --args=BasicAPI drawto see the call graph of the class Circle.
3: Android Instrumentation
This chapter teaches you how to insert logging into Android apps without access to their source code. Here’s how:
- To log method calls:
.gradlew run --args=AndroidLoggerfor the Numix Calculator APK. - To create and inject a class:
.gradlew run --args=AndroidClassInjector. Please remember to sign the instrumented APK before installation.
4: Call Graphs and PointsTo Analysis in Android
This chapter emphasizes creating call graphs and performing PointsTo analyses. To execute:
- Run:
.gradlew run --args=AndroidCallGraph CG_Algorithmto visualize the call graphs for the Soot Tutorial Demo App. - Run:
.gradlew run --args=AndroidPTAfor PointsTo and Alias Analysis.
5: Some Real Static Analysis (Work in Progress)
This chapter explores real-world usage and custom analyses.
- Run:
.gradlew run --args=UsageFinderto find usages of methods in the UsageExample.java. - Explore Null Pointer Analysis as well with the provided examples.
Troubleshooting
If you encounter issues while following this tutorial, here are some common troubleshooting tips:
- Ensure Java 8 is properly installed and added to your system path.
- Check for the correct version of Soot using the command:
.gradlew dependencies. - If a command fails, review the input arguments for any typos or incorrect names.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

