1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

LibWasm: Add execution hooks and a debugger mode to the wasm tool

This is useful for debugging *our* implementation of wasm :P
This commit is contained in:
Ali Mohammad Pur 2021-05-21 21:10:44 +04:30 committed by Ali Mohammad Pur
parent f740667fa1
commit ba5da79617
8 changed files with 299 additions and 4 deletions

View file

@ -113,6 +113,8 @@ InstantiationResult AbstractMachine::instantiate(const Module& module, Vector<Ex
entry.expression(),
1);
Configuration config { m_store };
config.pre_interpret_hook = &pre_interpret_hook;
config.post_interpret_hook = &post_interpret_hook;
config.set_frame(move(frame));
auto result = config.execute();
// What if this traps?
@ -143,6 +145,8 @@ InstantiationResult AbstractMachine::instantiate(const Module& module, Vector<Ex
data.offset,
1);
Configuration config { m_store };
config.pre_interpret_hook = &pre_interpret_hook;
config.post_interpret_hook = &post_interpret_hook;
config.set_frame(move(frame));
auto result = config.execute();
size_t offset = 0;
@ -281,7 +285,10 @@ Optional<InstantiationError> AbstractMachine::allocate_all(const Module& module,
Result AbstractMachine::invoke(FunctionAddress address, Vector<Value> arguments)
{
return Configuration { m_store }.call(address, move(arguments));
Configuration configuration { m_store };
configuration.pre_interpret_hook = &pre_interpret_hook;
configuration.post_interpret_hook = &post_interpret_hook;
return configuration.call(address, move(arguments));
}
void Linker::link(const ModuleInstance& instance)