Skip to content

Commit

Permalink
Merge pull request #529 from ewasm/wabt-debug
Browse files Browse the repository at this point in the history
Expose debugging methods under the correct namespace in wabt
  • Loading branch information
axic authored Apr 26, 2019
2 parents 6fa6f0b + a42c93a commit 3eadb85
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/wabt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ExecutionResult WabtEngine::execute(
ExecutionResult result;
WabtEthereumInterface interface{context, state_code, msg, result, meterInterfaceGas};

// Create host module
// Create EEI host module
// The lifecycle of this pointer is handled by `env`.
interp::HostModule* hostModule = env.AppendHostModule("ethereum");
heraAssert(hostModule, "Failed to create host module.");
Expand Down Expand Up @@ -581,9 +581,12 @@ ExecutionResult WabtEngine::execute(
}
);

// some extra methods for debugging

#if HERA_DEBUGGING
// Create debug host module
// The lifecycle of this pointer is handled by `env`.
hostModule = env.AppendHostModule("debug");
heraAssert(hostModule, "Failed to create host module.");

hostModule->AppendFuncExport(
"printMemHex",
{{Type::I32, Type::I32}, {}},
Expand Down Expand Up @@ -672,7 +675,7 @@ void WabtEngine::verifyContract(std::vector<uint8_t> const& code) {
// and the list of modules used for importing/exporting between modules
interp::Environment env;

// Create host module
// Create EEI host module
// The lifecycle of this pointer is handled by `env`.
interp::HostModule* hostModule = env.AppendHostModule("ethereum");
heraAssert(hostModule, "Failed to create host module.");
Expand Down Expand Up @@ -1106,9 +1109,12 @@ void WabtEngine::verifyContract(std::vector<uint8_t> const& code) {
}
);

// some extra methods for debugging

#if HERA_DEBUGGING
// Create debug host module
// The lifecycle of this pointer is handled by `env`.
hostModule = env.AppendHostModule("debug");
heraAssert(hostModule, "Failed to create host module.");

hostModule->AppendFuncExport(
"printMemHex",
{{Type::I32, Type::I32}, {}},
Expand Down

0 comments on commit 3eadb85

Please sign in to comment.