Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Output original opcode instead of PUSHC/JUMPC/JUMPCI in VM trace (#5852)
Browse files Browse the repository at this point in the history
Output original opcode instead of PUSHC/JUMPC/JUMPCI in VM trace
  • Loading branch information
gumb0 authored Nov 27, 2019
2 parents bdc7674 + 514539a commit d3553a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- Fixed: [#5821](https://github.com/ethereum/aleth/pull/5821) `test_setChainParams` correctly initializes custom configuration of precompiled contracts.
- Fixed: [#5826](https://github.com/ethereum/aleth/pull/5826) Fix blocking bug in database rebuild functionality - users can now rebuild their databases via Aleth's '-R' switch.
- Fixed: [#5827](https://github.com/ethereum/aleth/pull/5827) Detect database upgrades and automatically rebuild the database when they occur.
- Fixed: [#5834](https://github.com/ethereum/aleth/pull/5834) Fix segmentation fault during sync.
- Fixed: [#5852](https://github.com/ethereum/aleth/pull/5852) Output correct original opcodes instead of synthetic `PUSHC`/`JUMPC`/`JUMPCI` in VM trace.

## [1.7.2] - 2019-11-22

Expand Down
11 changes: 6 additions & 5 deletions libevm/LegacyVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ uint64_t LegacyVM::decodeJumpvDest(const byte* const _code, uint64_t& _pc, byte
//
// for tracing, checking, metering, measuring ...
//
void LegacyVM::onOperation()
void LegacyVM::onOperation(Instruction _instr)
{
if (m_onOp)
(m_onOp)(++m_nSteps, m_PC, m_OP,
(m_onOp)(++m_nSteps, m_PC, _instr,
m_newMemSize > m_mem.size() ? (m_newMemSize - m_mem.size()) / 32 : uint64_t(0),
m_runGas, m_io_gas, this, m_ext);
}
Expand Down Expand Up @@ -1474,7 +1474,8 @@ void LegacyVM::interpretCases()
CASE(PUSHC)
{
#if EVM_USE_CONSTANT_POOL
ON_OP();
auto const originalOp = static_cast<byte>(Instruction::PUSH1) + m_code[m_PC + 3] + 1;
onOperation(static_cast<Instruction>(originalOp));
updateIOGas();

// get val at two-byte offset into const pool and advance pc by one-byte remainder
Expand Down Expand Up @@ -1569,7 +1570,7 @@ void LegacyVM::interpretCases()
CASE(JUMPC)
{
#if EVM_REPLACE_CONST_JUMP
ON_OP();
onOperation(Instruction::JUMP);
updateIOGas();

m_PC = uint64_t(m_SP[0]);
Expand All @@ -1582,7 +1583,7 @@ void LegacyVM::interpretCases()
CASE(JUMPCI)
{
#if EVM_REPLACE_CONST_JUMP
ON_OP();
onOperation(Instruction::JUMPI);
updateIOGas();

if (m_SP[1])
Expand Down
3 changes: 2 additions & 1 deletion libevm/LegacyVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ class LegacyVM: public VMFace
std::vector<uint64_t> m_jumpDests;
int64_t verifyJumpDest(u256 const& _dest, bool _throw = true);

void onOperation();
void onOperation() { onOperation(m_OP); }
void onOperation(Instruction _instr);
void adjustStack(unsigned _removed, unsigned _added);
uint64_t gasForMem(u512 const& _size);
void updateSSGas();
Expand Down

0 comments on commit d3553a5

Please sign in to comment.