cognitive-engineering-lab / aquascope

Interactive visualizations of Rust at compile-time and run-time
https://cel.cs.brown.edu/aquascope/
MIT License
2.05k stars 48 forks source link

How to use on existing program? #60

Open TCROC opened 1 year ago

TCROC commented 1 year ago

This is a super cool tool! It is great for understanding Rust and for debugging purposes. Is there a way to run and use this locally on an existing project?

willcrichton commented 1 year ago

Right now the only end-to-end way to generate a diagram is to use either the online tool or use the mdbook integration. It's actually quite easy to generate the intermediate Aquascope data structures by running cargo aquascope within a given repository. But we still need to hook it up into a webpage that can visualize that data. Ideally there'd be a VSCode extension to do this, but we haven't had the time yet to realize it.

TCROC commented 1 year ago

This sounds awesome! With if you just did something like run:

cargo aquascope and it started up a local webserver that you could see the structures with in the browser?

willcrichton commented 1 year ago

Yeah, or even simpler it just outputs a .html file that has all the necessary JS and CSS bundled into the page. Like how flamegraph generates standalone SVG.

Part of the other issue is that we don't have great controls for look through long execution traces. Right now the tool is optimized for programs in the Rust Book, where the author (me) can select ahead of time the subset of states to visualize. We'll need to have some kind of interface, maybe a scrubber, for going through all the states.

TCROC commented 1 year ago

That sounds awesome! :)

tshirtman commented 9 months ago

If there was an intermediate representation before generating the html, that could be exported to e.g, json, that would certainly make it easier to build such an IDE plugin. Looks like an amazing look into how a function is understood by the rust compiler and i think the ability to see that while editing would be awesome.

BTW Just watched your rust conf presentation, and as a rust beginner, great work!

willcrichton commented 5 months ago

Note: we have provided instructions for running the playground locally. https://github.com/cognitive-engineering-lab/aquascope?tab=readme-ov-file#local-playground

I'll leave this issue up because it would still be useful to have a tool generate a standalone web page.

TCROC commented 4 months ago

Note: we have provided instructions for running the playground locally. https://github.com/cognitive-engineering-lab/aquascope?tab=readme-ov-file#local-playground

I'll leave this issue up because it would still be useful to have a tool generate a standalone web page.

Brilliant! I'll try this out when I get a free moment! :)