You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: frontends/rust/README.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,20 +20,26 @@ This tool operates in three primary phases:
20
20
21
21
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.
22
22
23
-
### Step 1: Source Analysis and Function/Method Extraction
23
+
##Source files
24
24
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:
26
26
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.
28
28
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
30
36
The source analysis process targets to identify all rust source files from the project directory while excluding unnecessary files.
31
37
32
38
1.**Directory Traversal**: Uses Rust's `std::fs` and `walkdir` crates to traverse the project directory.
33
39
2.**File Filtering**: Ensures only `.rs` files are processed.
34
40
3.**Exclusion Handling**: Skips files within excluded directories.
35
41
36
-
####Function/Method Extraction
42
+
### Function/Method Extraction
37
43
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.
38
44
39
45
The **Syn** crate provides the following applications:
@@ -67,6 +73,4 @@ The tool analyses the function body (`Block`) to calculate cyclomatic complexity
67
73
68
74
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.
69
75
70
-
### Conclusion
71
-
72
76
By leveraging the **Syn** crate, `FunctionAnalyser` systematically extracts and analyses function and method data, enabling comprehensive code analysis.
0 commit comments