Skip to content

Instantly share code, notes, and snippets.

@hugo-dc
Last active April 27, 2018 04:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugo-dc/6ab4360ef03443a3079c7c844e6cbd1d to your computer and use it in GitHub Desktop.
Save hugo-dc/6ab4360ef03443a3079c7c844e6cbd1d to your computer and use it in GitHub Desktop.
cpp-ethereum breakpoints

Transaction Gas:

libethcore/Transactionbase.cpp

In function baseGasRequired, print the initial g, it can be 'transaction cost' or 'create cost', and print g again before it gets returned, now it will contain the cost for the sent in the transaction.

https://github.com/ethereum/cpp-ethereum/blob/c7528cdcd417e50a01909c8b621ad12c7d491856/libethcore/TransactionBase.cpp#L202

libethereum/Executive.cpp

In function finalize, print gasUsed() (inside the last if statement): https://github.com/ethereum/cpp-ethereum/blob/9a13ce49082eee29e5d9159c3549087c675fa50c/libethereum/Executive.cpp#L507

libethereum/State.cpp

In function State::execute, before the TransactionReceipt is created, print startGasUsed and e.gasUsed(): https://github.com/ethereum/cpp-ethereum/blob/aa6e085e593dad863e0ed9888c65f488b8348a5e/libethereum/State.cpp#L579

libevm/EVMC.cpp

In function EVMC::exec, before the switch statement print the status r.status(), the initial value of io_gas and the result of r.gasLeft():

https://github.com/ethereum/cpp-ethereum/blob/3f2ac7c4f9e1543eb4f31cbdcdf8028eb9bfe0b6/libevm/EVMC.cpp#L41

hera/src/eei.cpp

In function takeGas print argument gas:

https://github.com/ewasm/hera/blob/a6c07f975e890b0da3ee07ed1ddf0d9247b5b5c1/src/eei.cpp#L762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment