-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add debug file dump #7375
base: master
Are you sure you want to change the base?
Add debug file dump #7375
Conversation
14d6720
to
7cdf9ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not too sure i am fond of this approach, ideally we'd move away from allocating a big chunk of memory for the debugger, i.e. ideally we'd move away from record/replay
Thanks for comment! Do you find the idea of changing record/replay approach as a new feature request or a blocker for that functionality? This record/replay could be also run only for the dumping or dump can be created on the fly and written to file. The main idea is to be able to use that output for post processing things. Other approach could be to create a plugin system and move things like that out of the core of foundry. What do you think? |
hmm, thinking about this more, I think this is ok. if/when we move away from record/replay we can always change this as well would like input from @DaniPopes iirc there are some coming changes to the debugger? |
a131d07
to
940393c
Compare
940393c
to
0026488
Compare
26f36b6
to
84608e0
Compare
ping @DaniPopes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
84608e0
to
27dbb83
Compare
Just fixed tests (clippy + fmt) |
…debugger context to file as json.
27dbb83
to
fc8a710
Compare
Fixed (again) - now using proper rust version locally. I don't know if this is intentional or not but in Cargo.toml there is |
Any chances for merging this one? :) I don't want to mix same code and I could then work on fixing this #7292. |
very sorry about this @piohei this now has a few conflicts that must be resolved first, still supportive of that feature |
No problem. I will fix them. :) |
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 #7364
Solution
New
--dump
param is being added toforge debug
andforge 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.