Skip to content

Commit

Permalink
feat(docs): CallGraph Documentation (#28)
Browse files Browse the repository at this point in the history
Closes #24

---------

Co-authored-by: Georgiy Komarov <jubnzv@gmail.com>
  • Loading branch information
Esorat and jubnzv authored Nov 16, 2024
1 parent d1ad213 commit e82fc83
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"Dont",
"consteval",
"Georgiy",
"Komarov"
"Komarov",
"callgraph"
],
"flagWords": [],
"ignorePaths": [
Expand Down
33 changes: 33 additions & 0 deletions docs/tools/DumpCallGraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# DumpCallGraph

Misti provides a feature to dump the [Call Graph (CG)](https://en.wikipedia.org/wiki/Call_graph) in JSON, DOT, and Mermaid formats. This is essential for understanding the function call relationships within your Tact contracts and analyzing the flow of function calls.

## Usage

To dump the CG in Mermaid format, use the following command:

```bash
misti -t "DumpCallGraph:format=mmd" <TACT_CONFIG_PATH|TACT_FILE_PATH> > callgraph.mmd
```

To dump the CG in Graphviz DOT format, use the following command:

```bash
misti -t "DumpCallGraph:format=dot" <TACT_CONFIG_PATH|TACT_FILE_PATH> > callgraph.dot
```

To dump the CG in JSON format, use the following command:

```bash
misti -t "DumpCallGraph:format=json" <TACT_CONFIG_PATH|TACT_FILE_PATH> > callgraph.json
```

## Further Information

For detailed instructions on how to work with the generated Mermaid, Graphviz DOT, and JSON files—including how to view, convert, and visualize them—please refer to the [DumpCfg documentation](./DumpCfg.md#working-with-graphviz). The steps and tools used for `DumpCallGraph` outputs are the same as those described for `DumpCfg`.

By utilizing the `DumpCallGraph` tool, developers can gain deeper insights into the function call structure of their contracts and effectively debug and enhance their code.

---

**Note:** Replace `<TACT_CONFIG_PATH|TACT_FILE_PATH>` with the actual path to your Tact configuration file or Tact contract file when running the commands.
5 changes: 5 additions & 0 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ const sidebars: SidebarsConfig = {
id: 'hacking/custom-detector',
label: 'Writing Custom Detectors',
},
{
type: 'doc',
id: 'hacking/custom-detector',
label: 'Writing Custom Detectors',
},
],
};

Expand Down
Loading

0 comments on commit e82fc83

Please sign in to comment.