I'm making a Qt-based GUI debugger for EVM (and TVM)
Hi all,
I'm putting together a new GUI debugger for EVM (and TVM i.e. TRON's fork of it) using C++ and Qt. I've already put together a first draft of the GUI for it (see screenshot below):
Screenshot of the EVM/TVM Debugger GUI design (first draft)
This is the default layout when you open the application (showing all areas but not everything within them), all the little panels can be dragged in/out (to make space) and the dock widgets (sub-windows) can be detached from the main window and put wherever you want, onto another monitor, resized etc.
This debugger is meant to be used for smart contracts where you don't have the source code and you're trying to piece together how it works and fill in the various fields such as ABI and storage layout as you go (and the scratchpad is there to make notes and write your 'decompile' of the code). Of course if you have the smart contract source code you can try to fill in these parts manually, and loading the ABI JSON will be supported if you have it (e.g. on TRON blockchain this is typically published) giving you a better starting point.
This is a list of intended features for the application:
- Full setting of all blockchain and block parameters that affect execution, including instruction set and network's address prefix byte (as used by TRON's TVM)
- Establishing unlimited number of blockchain accounts to use as EOA with coin/token balances and/or loaded with contracts (either constructor can be run or deployed bytecodes can be loaded directly), can refer to them using either hex or base58 (for TRON)
- Execution of constructor and function 'message calls' with full debugging capability, including breakpoints (on code or any memory area on read/write) running the program backwards and ability to edit any values in storage/memory/etc. during execution, including moving the program counter somewhere else
- See memory or watched values highlighted if they have changed since the last debugged instruction
- Code coverage and execution counts recorded against all instructions within a contract's bytecode over its whole lifetime (can be reset)
- Edit layout of storage, memory watches, ABI and related layout of constructor arguments, call data and return data, so you can view all the information easily, referencing data types such as type aliases, structs and enums that can be defined
- Disassembly that supports editing, adding tags to instructions that can be traced in the execution stack entries, and adding labels to instructions to mark internal function calls (specifying return address parameter, number of inputs and outputs)
- Support for viewing previous entries in the call stack so you can see the full execution state
- Full search capability for data inside storage, various memory areas, bytecode etc.
- Accurate gas (known as energy on TVM) measurements for a transaction
- Full event logs kept for all contracts, including preimages for indexed arguments of the event
- Console that can be used to perform calculations (including hashes) and refer to all areas of memory to allow an alternative to using the GUI to pull out or modify data
- Saving of a full software snapshot (allowing you to resume your place in the debugging) or save contents of individual accounts that can be imported to another blockchain configuration (possibly at a different address)
- Built-in help including tooltips, "What's This?" and F1 full help pages
- Full support of all EVM/TVM features and instruction set up to Constantinople (including all precompiled contracts)
I welcome any questions or feedback, including feature/other requests, here on this thread!
BTW, the project will still be called 'EVM/TVM Debugger' as its official name, if you want to search for it in future.
Posted Jul 17, 2019, 10:09 PM UTC
No offense, but was your UI inspired by File Matrix? https://weblogs.asp.net/alex_papadimoulis/146784
Regardless, will this be open source?
I agree that the UI looks overcrowded; this is a result of trying to pack everything into one window. Unfortunately there's a lot of information associated with running a smart contract (as you can see)... However, as it is, the UI is very flexible: like I said all the dock windows can be dragged out, resized and also they can be stacked on top of each other (with tabs), and the splits can be dragged in/out to hide/reveal parts of the windows.
It would maybe be prudent to think about redesigning the UI (at least the default layout) because of the overcrowding, but then it's hard to optimize the UI without knowing how the tool will be used. Some third party input on what's important to show would also be very useful.
Here's another screenshot showing how the UI can look after moving things around and stacking some of the dock windows into tabs. This at least seems more usable...
On whether this will be open source the answer is yes, it will be published on GitHub. To comply with the demands of Qt licensing (in their free offering) it will probably have to be GPLv3.
Had another go at laying out the dock windows (screenshot), somehow it looks a lot better, what do you think?
I might decide to abandon the idea of using dock widgets for everything and go with an MDI approach for the main part, but it's not clear right now what the sub-windows should consist of and what might stay in dock widgets.
For the CPU sub-window it seems like the following are all still kinda required in the main area:
I might consider it necessary to add a proper toolbar onto the window to allow easy access to the sub-windows that are not shown.
Anyway, definitely seems like there's a lot more work to do on getting a good GUI...
I think the main problem is that most of the info presented is unneeded except for when it is needed. I'd personally allow for all of that to be shown, but hide it behind a series of buttons or whatever to active each view (and of course be able to hide it as well).. and to figure out the most needed stuff and make that and only that info the default view
Yeah, that sounds like where I'm heading with it. Also, I had another thought: that the view for when you are executing code should be different than the view when you're not. So this all adds to the complexity.
I made a new post to show my latest progress if you want to check it out: https://www.reddit.com/r/ethdev/comments/cfsot5/evmtvm_debugger_gui_design_second_attempt/
Coded up that layout and made another screenshot (this time with window in full screen). Unfortunately there seems to be some bugs in Qt affecting the initial layout which makes it a no go (unless I can find/guess the problem). (There is also another bug with this heavy use of dock widgets that also affected the first version.)
Anyway, this is a good improvement on the first draft for usability, and closer to how things will be in the next iteration. Probably the top and bottom docks will remain as dock windows, with all the stuff on the right edge being represented in MDI sub-windows that can be brought up in the toolbar I'm going to add. (Or something like that.)