Is it feasible to debug a solidity contract using the go-ethereum
evm command? And what would be the steps required to do so?
After deploying your contract or executing one of its methods, a button appears:
If you click this, it takes you to a debugger tab where you can step through, using the buttons provided, the EVM code as it was executed for that transaction. Hover over the buttons to see their description.
All sorts of EVM state data is available as you step through:
You can expand these tabs to see the data. The most useful bits for me are viewing (1) the instructions (EVM bytecode as it is executed), (2) the stack, (3) the memory, (4) the storage. But other info is sometimes useful. It's a great learning environment.
In the left-pane, the browser highlights which bit of the Solidity code are currently being executed. This is not 100% reliable or intuitive, but is a helpful guide for debugging.
Well to debug your solidity contract, I strongly advise you to use ethereum IDE (like Remix). Generally It enable you to pass the compilation (otherwise errors showed by the compilator don't tell you anything).
Then if you want to debug your function I advise you to use the truffle framework with enable you to "test" your contract functions. When you deploy your framework on the private blockchain (or the test blockchain) you can test your functions easily.
With truffle what you do is :
- init your project (
- write your contract in contract/ and write the test function of your contract in test/ and compile it
- then test your contract with
I strongly recommand you to deploy and test your contract on the testrpc network or private blockchain first before deploying on the real ethereum blockchain.