The Remix editor
We used the Remix editor to write Solidity contracts in the previous chapters. However, we have not used the debugging utility available in Remix. The Remix Debugger helps us observe the runtime behavior of contract execution and identify issues. The Debugger works in Solidity and the resultant contract bytecode. With the Debugger, the execution can be paused to examine contract code, state variables, local variables, and stack variables, and view the EVM instructions generated by the contract code.
The following block of contract code will be used to demonstrate debugging in the Remix editor:
pragma solidity ^0.8.9; contract DebuggerSampleContract { int counter = 10; function LoopCounter(int _input) public view returns(int) { int returnValue; for ( ; _input < counter ; _input++ ...