Skip to content

Conversation

@Unparalleled-Calvin
Copy link
Contributor

@Unparalleled-Calvin Unparalleled-Calvin commented Dec 23, 2025

Modification

  • remove repeated files: rapx/src/analysis/upg/draw_dot.rs.
  • rename rapx/src/analysis/utils/data to rapx/src/analysis/utils/assets.
  • add a static html file template at rapx/src/analysis/utils/assets.
  • use struct DotGraph for draw_dot.rs and refactor existing code.
  • add extra html geneation logic for upg analysis (cargo rapx -upg)
  • add a bash script to automatically build docs, build upgs, modify generated html files, and set up a python server to serve the files.

Description

The newly generated html can display the dot graph and open the source code page while clicking the node.
The placeholders in index.html.template are :

  • TITLE: the title of the graph
  • DOT: the dot description of the graph
  • URL_MAP: a map with node label as its key and relative url as its value.
    e.g., "DefId(0:4 ~ recursion[3bdf]::main)" -> "main.rs.html#9"
  • BASE_URL: the source code (generated by cargo doc) base url

https://github.com/Artisan-Lab/RAPx/blob/5752fef086bf4403bbb0099de1ef0161d3a79e90/rapx/src/analysis/utils/assets/index.html.template#L24-L29

In the current implementation, TITLE, DOT and URL_MAP are filled by RAPx. And BASE_URL is filled by the script serve.sh. The nodes in the html are binded with a click event to open corresponding doc page.

Usage of serve.sh

https://github.com/Artisan-Lab/RAPx/blob/5752fef086bf4403bbb0099de1ef0161d3a79e90/serve.sh#L4-L18

A typical example:

./serve.sh -d rapx/tests/callgraph/recursion -p 8080
image image

When clicking main:
image

Issues

  • Test. Currently I only test the code on rapx/tests/callgraph/recursion (need more knowledge of UPG)
  • Symbols. The url map now only supports doc link of local projects. For external symbols, e.g. std symbols, dependencies, the processing is skipped.
  • UI. The html ui can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants