This tool provides two main features for analyzing Java applications:
- Static Call Hierarchy Analysis
- Execution Path Logging
- Java 11 or higher
- Maven 3.6 or higher
mvn clean package
This will create a JAR file in the target
directory named asm-analyzer-1.0-SNAPSHOT-jar-with-dependencies.jar
.
The tool accepts the following command-line arguments:
-p, --project <path>
: Path to the Java project directory (required)-a, --analyze
: Perform static call hierarchy analysis-l, --log
: Instrument the project for execution path logging-o, --output <path>
: Output file path for analysis results (default: call-hierarchy.txt)-h, --help
: Display help message
- Analyze static call hierarchy:
java -jar target/asm-analyzer-1.0-SNAPSHOT-jar-with-dependencies.jar -p /path/to/project -a -o analysis.txt
- Instrument for execution path logging:
java -jar target/asm-analyzer-1.0-SNAPSHOT-jar-with-dependencies.jar -p /path/to/project -l
- Both analysis and logging:
java -jar target/asm-analyzer-1.0-SNAPSHOT-jar-with-dependencies.jar -p /path/to/project -a -l
The analysis results will be saved to the specified output file (default: call-hierarchy.txt). The file contains a hierarchical view of method calls in the project.
When the project is instrumented for execution path logging, the tool will:
- Modify the class files to add logging statements
- Log method entry and exit events to both console and a file named
execution.log
- Show the call hierarchy depth through indentation
- The tool requires compiled
.class
files to analyze - For execution path logging, the project must be recompiled after instrumentation
- The tool will process all
.class
files in the specified directory and its subdirectories