foundry
foundry copied to clipboard
Add debug file dump
Motivation
It could be very helpful to be able to dump to a JSON file whole debugger context: calls, source code, refs, etc. It would allow then to do a post processing like for example creating heatmap for most costly lines in terms of gas usage.
Closes https://github.com/foundry-rs/foundry/issues/7364 Closes https://github.com/foundry-rs/foundry/issues/7112
Solution
New --dump
param is being added to forge debug
and forge test --debug
commands. It requires a path to file where to dump data and passing --debug flag same time. Debugger code is refactored to create abstraction over it. It is then used by two different presenters: TUI (interactive debugger) and file dumper. I also added to debugger data original path for the source file to allow figuring out where to make changes when debugging.