mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibWasm: Use AllocatingMemoryStream around Wasm::Printer
This commit is contained in:
committed by
Linus Groh
parent
7d4a30af56
commit
52cb066cae
Notes:
sideshowbarker
2024-07-17 01:28:15 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/52cb066cae Pull-request: https://github.com/SerenityOS/serenity/pull/17071
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/MemoryStream.h>
|
||||
#include <LibWasm/AbstractMachine/Configuration.h>
|
||||
#include <LibWasm/AbstractMachine/Interpreter.h>
|
||||
#include <LibWasm/Printer/Printer.h>
|
||||
@@ -85,9 +86,11 @@ Result Configuration::execute(Interpreter& interpreter)
|
||||
void Configuration::dump_stack()
|
||||
{
|
||||
auto print_value = []<typename... Ts>(CheckedFormatString<Ts...> format, Ts... vs) {
|
||||
DuplexMemoryStream memory_stream;
|
||||
Printer { memory_stream }.print(vs...);
|
||||
ByteBuffer buffer = memory_stream.copy_into_contiguous_buffer();
|
||||
Core::Stream::AllocatingMemoryStream memory_stream;
|
||||
Core::Stream::WrapInAKOutputStream wrapped_memory_stream { memory_stream };
|
||||
Printer { wrapped_memory_stream }.print(vs...);
|
||||
auto buffer = ByteBuffer::create_uninitialized(memory_stream.used_buffer_size()).release_value_but_fixme_should_propagate_errors();
|
||||
memory_stream.read_entire_buffer(buffer).release_value_but_fixme_should_propagate_errors();
|
||||
dbgln(format.view(), StringView(buffer).trim_whitespace());
|
||||
};
|
||||
for (auto const& entry : stack().entries()) {
|
||||
|
||||
Reference in New Issue
Block a user