mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails instead of just "too bad, something went wrong".
This commit is contained in:
committed by
Ali Mohammad Pur
parent
62ca81fdcc
commit
b538e15548
@@ -136,7 +136,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
});
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap())
|
||||
instantiation_result = InstantiationError { "Global value construction trapped" };
|
||||
instantiation_result = InstantiationError { String::formatted("Global value construction trapped: {}", result.trap().reason) };
|
||||
else
|
||||
global_values.append(result.values().first());
|
||||
}
|
||||
@@ -161,7 +161,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
});
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { "Element construction trapped" };
|
||||
instantiation_result = InstantiationError { String::formatted("Element construction trapped: {}", result.trap().reason) };
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
});
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { "Element section initialisation trapped" };
|
||||
instantiation_result = InstantiationError { String::formatted("Element section initialisation trapped: {}", result.trap().reason) };
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
auto d = result.values().first().to<i32>();
|
||||
@@ -270,7 +270,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
});
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { "Data section initialisation trapped" };
|
||||
instantiation_result = InstantiationError { String::formatted("Data section initialisation trapped: {}", result.trap().reason) };
|
||||
return;
|
||||
}
|
||||
size_t offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user