Make tracing feature optional

This commit is contained in:
Paweł Bylica 2018-06-18 14:22:16 +02:00
parent d2ac75f6a8
commit 9e31e93fec
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 7 additions and 3 deletions

View File

@ -789,7 +789,11 @@ struct evmc_instance
/** Pointer to function executing a code by the EVM instance. */
evmc_execute_fn execute;
/** Pointer to function setting the EVM instruction tracer. */
/**
* Optional pointer to function setting the EVM instruction tracer.
*
* If the EVM does not support this feature the pointer can be NULL.
*/
evmc_set_tracer_fn set_tracer;
/**

View File

@ -66,6 +66,6 @@ TEST_F(evmc_vm_test, set_tracer)
static constexpr auto tracer_callback = [](evmc_tracer_context*, int, size_t, evmc_status_code,
int64_t, size_t, const evmc_uint256be*, size_t,
size_t, size_t, const uint8_t*) noexcept {};
ASSERT_NE(vm->set_tracer, nullptr);
vm->set_tracer(vm, tracer_callback, nullptr);
if (vm->set_tracer)
vm->set_tracer(vm, tracer_callback, nullptr);
}