Skip to content

Commit 9dbefee

Browse files
committed
Fix README
Signed-off-by: Arthur Chan <[email protected]>
1 parent eccdb9d commit 9dbefee

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

frontends/rust/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,26 @@ This tool operates in three primary phases:
2020

2121
The `main.rs` is the major entry points of the Rust frontend analyser. It manage the calls to `analyse.rs`, `call_tree.rs` and `generate_yaml.rs` separately to operates the three phases mentioned above.
2222

23-
### Step 1: Source Analysis and Function/Method Extraction
23+
## Source files
2424

25-
The `main.rs` takes in a provide source directory path (or retrieved from the environment variable $SRC in OSS-Fuzz docker image). It then pass the project source directory to `analyse.rs` for source analysis and function/method extraction
25+
Here’s a refined version in British English:
2626

27-
The `analysis.rs` performs both the source analysis and function/method extraction.
27+
The `main.rs` script accepts a source directory path (or retrieves it from the environment variable `$SRC` in the OSS-Fuzz Docker image). It then passes the project source directory to `analyse.rs` for source analysis and function/method extraction.
2828

29-
#### Source Analysis
29+
The `analyse.rs` script performs both source analysis and function/method extraction (details provided below).
30+
31+
The `call_tree.rs` script identifies fuzzing harnesses (marked with the `fuzz_target` macro) in the specified source directory. It generates call graphs linking the functions extracted by `analyse.rs` to the function calls within each fuzzing harness's `fuzz_target` macro. The output is saved to `fuzzerLogFile-<fuzzing_harness_name>.data`.
32+
33+
The `generate_yaml.rs` script produces YAML files containing all the functions extracted from the project source directory by `analyse.rs`. The output is saved as `fuzzerLogFile-<fuzzing_harness_name>.data.yaml`.
34+
35+
### Source Analysis
3036
The source analysis process targets to identify all rust source files from the project directory while excluding unnecessary files.
3137

3238
1. **Directory Traversal**: Uses Rust's `std::fs` and `walkdir` crates to traverse the project directory.
3339
2. **File Filtering**: Ensures only `.rs` files are processed.
3440
3. **Exclusion Handling**: Skips files within excluded directories.
3541

36-
#### Function/Method Extraction
42+
### Function/Method Extraction
3743
The function/method extraction process adopt the **Syn** crate from the rust framework to extract Abstract-Syntax-Tree (AST) of the project source code and extract all functions/methods from the source directory together with their information.
3844

3945
The **Syn** crate provides the following applications:
@@ -67,6 +73,4 @@ The tool analyses the function body (`Block`) to calculate cyclomatic complexity
6773

6874
After traversal, the tool calculates function depths by tracing call relationships and resolves fully qualified method names for accuracy. It finalises function use counts from the reverse call map, offering a detailed view of function utilisation.
6975

70-
### Conclusion
71-
7276
By leveraging the **Syn** crate, `FunctionAnalyser` systematically extracts and analyses function and method data, enabling comprehensive code analysis.

0 commit comments

Comments
 (0)