UserspaceEmulator: Replace printf usages with format.

This replaces almost all usages. Some have to remain because 'outf'
always appends a newline. (It inherits this behaviour from LogStream.)
This commit is contained in:
asynts 2020-09-30 15:30:42 +02:00 committed by Andreas Kling
parent fb7a94c959
commit ba3488a6d5
Notes: sideshowbarker 2024-07-19 02:06:18 +09:00
6 changed files with 67 additions and 69 deletions

View file

@ -234,7 +234,7 @@ void Emulator::dump_backtrace()
u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
{
#ifdef DEBUG_SPAM
dbgprintf("Syscall: %s (%x)\n", Syscall::to_string((Syscall::Function)function), function);
dbgf("Syscall: {} ({:x})", Syscall::to_string((Syscall::Function)function), function);
#endif
switch (function) {
case SC_chdir:
@ -379,7 +379,7 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
case SC_fork:
return virt$fork();
default:
report("\n==%d== \033[31;1mUnimplemented syscall: %s\033[0m, %p\n", getpid(), Syscall::to_string((Syscall::Function)function));
warnf("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}", getpid(), Syscall::to_string((Syscall::Function)function), function);
dump_backtrace();
TODO();
}
@ -950,7 +950,7 @@ int Emulator::virt$ioctl(int fd, unsigned request, FlatPtr arg)
mmu().copy_from_vm(&termios, arg, sizeof(termios));
return syscall(SC_ioctl, fd, request, &termios);
}
dbg() << "Unsupported ioctl: " << request;
dbgf("Unsupported ioctl: {}", request);
dump_backtrace();
TODO();
}
@ -983,11 +983,10 @@ int Emulator::virt$execve(FlatPtr params_addr)
copy_string_list(arguments, params.arguments);
copy_string_list(environment, params.environment);
report("\n");
report("==%d== \033[33;1mSyscall:\033[0m execve\n", getpid());
report("==%d== @ %s\n", getpid(), path.characters());
warnf("\n=={}== \033[33;1mSyscall:\033[0m execve", getpid());
warnf("=={}== @ {}", getpid(), path);
for (auto& argument : arguments)
report("==%d== - %s\n", getpid(), argument.characters());
warnf("=={}== - {}", getpid(), argument);
Vector<char*> argv;
Vector<char*> envp;
@ -1200,7 +1199,7 @@ void Emulator::dispatch_one_pending_signal()
auto action = default_signal_action(signum);
if (action == DefaultSignalAction::Ignore)
return;
report("\n==%d== Got signal %d (%s), no handler registered\n", getpid(), signum, strsignal(signum));
warnf("\n=={}== Got signal {} ({}), no handler registered", getpid(), signum, strsignal(signum));
m_shutdown = true;
return;
}
@ -1210,7 +1209,7 @@ void Emulator::dispatch_one_pending_signal()
return;
}
report("\n==%d== Got signal %d (%s), handler at %p\n", getpid(), signum, strsignal(signum), handler.handler);
warnf("\n=={}== Got signal {} ({}), handler at {:p}", getpid(), signum, strsignal(signum), handler.handler);
auto old_esp = m_cpu.esp();

View file

@ -70,9 +70,8 @@ void MallocTracer::target_did_free(Badge<SoftCPU>, FlatPtr address)
for (auto& mallocation : m_mallocations) {
if (mallocation.address == address) {
if (mallocation.freed) {
report("\n");
report("==%d== \033[31;1mDouble free()\033[0m, %p\n", getpid(), address);
report("==%d== Address %p has already been passed to free()\n", getpid(), address);
warnf("\n=={}== \033[31;1mDouble free()\033[0m, {:p}", getpid(), address);
warnf("=={}== Address {} has already been passed to free()", getpid(), address);
Emulator::the().dump_backtrace();
} else {
mallocation.freed = true;
@ -81,9 +80,9 @@ void MallocTracer::target_did_free(Badge<SoftCPU>, FlatPtr address)
return;
}
}
report("\n");
report("==%d== \033[31;1mInvalid free()\033[0m, %p\n", getpid(), address);
report("==%d== Address %p has never been returned by malloc()\n", getpid(), address);
warnf("\n=={}== \033[31;1mInvalid free()\033[0m, {:p}", getpid(), address);
warnf("=={}== Address {} has never been returned by malloc()", getpid(), address);
Emulator::the().dump_backtrace();
}
@ -119,12 +118,11 @@ void MallocTracer::audit_read(FlatPtr address, size_t size)
auto* mallocation = find_mallocation(address);
if (!mallocation) {
report("\n");
report("==%d== \033[31;1mHeap buffer overflow\033[0m, invalid %zu-byte read at address %p\n", getpid(), size, address);
warnf("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte read at address {:p}", getpid(), size, address);
Emulator::the().dump_backtrace();
if ((mallocation = find_mallocation_before(address))) {
size_t offset_into_mallocation = address - mallocation->address;
report("==%d== Address is %zu byte(s) after block of size %zu, allocated at:\n", getpid(), offset_into_mallocation - mallocation->size, mallocation->size);
warnf("=={}== Address is {} byte(s) after block of size {}, allocated at:", getpid(), offset_into_mallocation - mallocation->size, mallocation->size);
Emulator::the().dump_backtrace(mallocation->malloc_backtrace);
}
return;
@ -133,12 +131,11 @@ void MallocTracer::audit_read(FlatPtr address, size_t size)
size_t offset_into_mallocation = address - mallocation->address;
if (mallocation->freed) {
report("\n");
report("==%d== \033[31;1mUse-after-free\033[0m, invalid %zu-byte read at address %p\n", getpid(), size, address);
warnf("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte read at address {:p}", getpid(), size, address);
Emulator::the().dump_backtrace();
report("==%d== Address is %zu byte(s) into block of size %zu, allocated at:\n", getpid(), offset_into_mallocation, mallocation->size);
warnf("=={}== Address is {} byte(s) into block of size {}, allocated at:", getpid(), offset_into_mallocation, mallocation->size);
Emulator::the().dump_backtrace(mallocation->malloc_backtrace);
report("==%d== Later freed at:\n", getpid());
warnf("=={}== Later freed at:", getpid());
Emulator::the().dump_backtrace(mallocation->free_backtrace);
return;
}
@ -154,12 +151,11 @@ void MallocTracer::audit_write(FlatPtr address, size_t size)
auto* mallocation = find_mallocation(address);
if (!mallocation) {
report("\n");
report("==%d== \033[31;1mHeap buffer overflow\033[0m, invalid %zu-byte write at address %p\n", getpid(), size, address);
warnf("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte write at address {:p}", getpid(), size, address);
Emulator::the().dump_backtrace();
if ((mallocation = find_mallocation_before(address))) {
size_t offset_into_mallocation = address - mallocation->address;
report("==%d== Address is %zu byte(s) after block of size %zu, allocated at:\n", getpid(), offset_into_mallocation - mallocation->size, mallocation->size);
warnf("=={}== Address is {} byte(s) into block of size {}, allocated at:", getpid(), offset_into_mallocation, mallocation->size);
Emulator::the().dump_backtrace(mallocation->malloc_backtrace);
}
return;
@ -168,12 +164,11 @@ void MallocTracer::audit_write(FlatPtr address, size_t size)
size_t offset_into_mallocation = address - mallocation->address;
if (mallocation->freed) {
report("\n");
report("==%d== \033[31;1mUse-after-free\033[0m, invalid %zu-byte write at address %p\n", getpid(), size, address);
warnf("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte write at address {:p}", getpid(), size, address);
Emulator::the().dump_backtrace();
report("==%d== Address is %zu byte(s) into block of size %zu, allocated at:\n", getpid(), offset_into_mallocation, mallocation->size);
warnf("=={}== Address is {} byte(s) into block of size {}, allocated at:", getpid(), offset_into_mallocation, mallocation->size);
Emulator::the().dump_backtrace(mallocation->malloc_backtrace);
report("==%d== Later freed at:\n", getpid());
warnf("=={}== Later freed at:", getpid());
Emulator::the().dump_backtrace(mallocation->free_backtrace);
return;
}
@ -194,7 +189,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
auto value = Emulator::the().mmu().read32({ 0x20, other_mallocation.address + i * sizeof(u32) });
if (value.value() == mallocation.address && !value.is_uninitialized()) {
#ifdef REACHABLE_DEBUG
report("mallocation %p is reachable from other mallocation %p\n", mallocation.address, other_mallocation.address);
warnf("mallocation {:p} is reachable from other mallocation {:p}", mallocation.address, other_mallocation.address);
#endif
return true;
}
@ -219,7 +214,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
auto value = region.read32(i * sizeof(u32));
if (value.value() == mallocation.address && !value.is_uninitialized()) {
#ifdef REACHABLE_DEBUG
report("mallocation %p is reachable from region %p-%p\n", mallocation.address, region.base(), region.end() - 1);
warnf("mallocation {:p} is reachable from region {:p}-{:p}", mallocation.address, region.base(), region.end() - 1);
#endif
reachable = true;
return IterationDecision::Break;
@ -243,16 +238,14 @@ void MallocTracer::dump_leak_report()
continue;
++leaks_found;
bytes_leaked += mallocation.size;
report("\n");
report("==%d== \033[31;1mLeak\033[0m, %zu-byte allocation at address %#08x\n", getpid(), mallocation.size, mallocation.address);
warnf("\n=={}== \033[31;1mLeak\033[0m, {}-byte allocation at address {:p}", getpid(), mallocation.size, mallocation.address);
Emulator::the().dump_backtrace(mallocation.malloc_backtrace);
}
report("\n");
if (!leaks_found)
report("==%d== \033[32;1mNo leaks found!\033[0m\n", getpid());
warnf("\n=={}== \033[32;1mNo leaks found!\033[0m", getpid());
else
report("==%d== \033[31;1m%zu leak(s) found: %zu byte(s) leaked\033[0m\n", getpid(), leaks_found, bytes_leaked);
warnf("\n=={}== \033[31;1m{} leak(s) found: {} byte(s) leaked\033[0m", getpid(), leaks_found, bytes_leaked);
}
}

View file

@ -68,7 +68,7 @@ MmapRegion::~MmapRegion()
ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset)
{
if (!is_readable()) {
warn() << "8-bit read from unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("8-bit read from unreadable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -85,7 +85,7 @@ ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset)
ValueWithShadow<u16> MmapRegion::read16(u32 offset)
{
if (!is_readable()) {
warn() << "16-bit from unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("16-bit read from unreadable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -102,7 +102,7 @@ ValueWithShadow<u16> MmapRegion::read16(u32 offset)
ValueWithShadow<u32> MmapRegion::read32(u32 offset)
{
if (!is_readable()) {
warn() << "32-bit read from unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("32-bit read from unreadable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -119,7 +119,7 @@ ValueWithShadow<u32> MmapRegion::read32(u32 offset)
ValueWithShadow<u64> MmapRegion::read64(u32 offset)
{
if (!is_readable()) {
warn() << "64-bit read from unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("64-bit read from unreadable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -136,7 +136,7 @@ ValueWithShadow<u64> MmapRegion::read64(u32 offset)
void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
{
if (!is_writable()) {
warn() << "8-bit write to unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("8-bit write from unwritable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -154,7 +154,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)
{
if (!is_writable()) {
warn() << "16-bit write to unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("16-bit write from unwritable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -172,7 +172,7 @@ void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)
void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value)
{
if (!is_writable()) {
warn() << "32-bit write to unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("32-bit write from unwritable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}
@ -191,7 +191,7 @@ void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value)
void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value)
{
if (!is_writable()) {
warn() << "64-bit write to unreadable MmapRegion @ " << (const void*)(base() + offset);
warnf("64-bit write from unwritable MmapRegion @ {:p}", base() + offset);
Emulator::the().dump_backtrace();
TODO();
}

View file

@ -60,7 +60,7 @@ template<typename T>
void warn_if_uninitialized(T value_with_shadow, const char* message)
{
if (value_with_shadow.is_uninitialized()) {
dbgprintf("\033[31;1mWarning! Use of uninitialized value: %s\033[0m\n", message);
dbgf("\033[31;1mWarning! Use of uninitialized value: {}\033[0m\n", message);
Emulator::the().dump_backtrace();
}
}
@ -68,8 +68,7 @@ void warn_if_uninitialized(T value_with_shadow, const char* message)
void SoftCPU::warn_if_flags_tainted(const char* message) const
{
if (m_flags_tainted) {
report("\n");
report("==%d== \033[31;1mConditional depends on uninitialized data\033[0m (%s)\n", getpid(), message);
warnf("\n=={}== \033[31;1mConditional depends on uninitialized data\033[0m ({})\n", getpid(), message);
Emulator::the().dump_backtrace();
}
}
@ -97,12 +96,10 @@ SoftCPU::SoftCPU(Emulator& emulator)
void SoftCPU::dump() const
{
printf("eax=%08x ebx=%08x ecx=%08x edx=%08x ", eax().value(), ebx().value(), ecx().value(), edx().value());
printf("ebp=%08x esp=%08x esi=%08x edi=%08x ", ebp().value(), esp().value(), esi().value(), edi().value());
printf("o=%u s=%u z=%u a=%u p=%u c=%u\n", of(), sf(), zf(), af(), pf(), cf());
printf("#ax=%08x #bx=%08x #cx=%08x #dx=%08x ", eax().shadow(), ebx().shadow(), ecx().shadow(), edx().shadow());
printf("#bp=%08x #sp=%08x #si=%08x #di=%08x ", ebp().shadow(), esp().shadow(), esi().shadow(), edi().shadow());
printf("#f=%u\n", m_flags_tainted);
outf(" eax={:08x} ebx={:08x} ecx={:08x} edx={:08x} ebp={:08x} esp={:08x} esi={:08x} edi={:08x} o={:d} s={:d} z={:d} a={:d} p={:d} c={:d}",
eax(), ebx(), ecx(), edx(), ebp(), esp(), esi(), edi(), of(), sf(), zf(), af(), pf(), cf());
outf("#eax={:08x} #ebx={:08x} #ecx={:08x} #edx={:08x} #ebp={:08x} #esp={:08x} #esi={:08x} #edi={:08x} #f={}",
eax().shadow(), ebx().shadow(), ecx().shadow(), edx().shadow(), m_flags_tainted);
fflush(stdout);
}
@ -133,7 +130,7 @@ ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address)
ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);
auto value = m_emulator.mmu().read8(address);
#ifdef MEMORY_DEBUG
printf("\033[36;1mread_memory8: @%08x:%08x -> %02x (%02x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mread_memory8: @{:04x}:{:08x} -> {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
}
@ -143,7 +140,7 @@ ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address)
ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);
auto value = m_emulator.mmu().read16(address);
#ifdef MEMORY_DEBUG
printf("\033[36;1mread_memory16: @%04x:%08x -> %04x (%04x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mread_memory16: @{:04x}:{:08x} -> {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
}
@ -153,7 +150,7 @@ ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address)
ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);
auto value = m_emulator.mmu().read32(address);
#ifdef MEMORY_DEBUG
printf("\033[36;1mread_memory32: @%04x:%08x -> %08x (%08x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mread_memory32: @{:04x}:{:08x} -> {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
}
@ -163,7 +160,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);
auto value = m_emulator.mmu().read64(address);
#ifdef MEMORY_DEBUG
printf("\033[36;1mread_memory64: @%04x:%08x -> %016llx (%016llx)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mread_memory64: @{:04x}:{:08x} -> {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
}
@ -172,7 +169,7 @@ void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> val
{
ASSERT(address.selector() == 0x20 || address.selector() == 0x28);
#ifdef MEMORY_DEBUG
printf("\033[35;1mwrite_memory8: @%04x:%08x <- %02x (%02x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mwrite_memory8: @{:04x}:{:08x} <- {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write8(address, value);
}
@ -181,7 +178,7 @@ void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> v
{
ASSERT(address.selector() == 0x20 || address.selector() == 0x28);
#ifdef MEMORY_DEBUG
printf("\033[35;1mwrite_memory16: @%04x:%08x <- %04x (%04x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mwrite_memory16: @{:04x}:{:08x} <- {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write16(address, value);
}
@ -190,7 +187,7 @@ void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> v
{
ASSERT(address.selector() == 0x20 || address.selector() == 0x28);
#ifdef MEMORY_DEBUG
printf("\033[35;1mwrite_memory32: @%04x:%08x <- %08x (%08x)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mwrite_memory32: @{:04x}:{:08x} <- {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write32(address, value);
}
@ -199,7 +196,7 @@ void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow<u64> v
{
ASSERT(address.selector() == 0x20 || address.selector() == 0x28);
#ifdef MEMORY_DEBUG
printf("\033[35;1mwrite_memory64: @%04x:%08x <- %016llx (%016llx)\033[0m\n", address.selector(), address.offset(), value.value(), value.shadow());
outf("\033[36;1mwrite_memory64: @{:04x}:{:08x} <- {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write64(address, value);
}

View file

@ -68,7 +68,7 @@ ValueWithShadow<u8> SoftMMU::read8(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::read8: No region for @" << (const void*)address.offset();
warnf("SoftMMU::read8: No region for @ {:p}", address.offset());
TODO();
}
@ -79,7 +79,7 @@ ValueWithShadow<u16> SoftMMU::read16(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::read16: No region for @" << (const void*)address.offset();
warnf("SoftMMU::read16: No region for @ {:p}", address.offset());
TODO();
}
@ -90,7 +90,7 @@ ValueWithShadow<u32> SoftMMU::read32(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::read32: No region for @" << (const void*)address.offset();
warnf("SoftMMU::read32: No region for @ {:p}", address.offset());
TODO();
}
@ -101,7 +101,7 @@ ValueWithShadow<u64> SoftMMU::read64(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::read64: No region for @" << (const void*)address.offset();
warnf("SoftMMU::read64: No region for @ {:p}", address.offset());
TODO();
}
@ -112,7 +112,7 @@ void SoftMMU::write8(X86::LogicalAddress address, ValueWithShadow<u8> value)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::write8: No region for @" << (const void*)address.offset();
warnf("SoftMMU::write8: No region for @ {:p}", address.offset());
TODO();
}
@ -123,7 +123,7 @@ void SoftMMU::write16(X86::LogicalAddress address, ValueWithShadow<u16> value)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::write16: No region for @" << (const void*)address.offset();
warnf("SoftMMU::write16: No region for @ {:p}", address.offset());
TODO();
}
@ -134,7 +134,7 @@ void SoftMMU::write32(X86::LogicalAddress address, ValueWithShadow<u32> value)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::write32: No region for @" << (const void*)address.offset();
warnf("SoftMMU::write32: No region for @ {:p}", address.offset());
TODO();
}
@ -145,7 +145,7 @@ void SoftMMU::write64(X86::LogicalAddress address, ValueWithShadow<u64> value)
{
auto* region = find_region(address);
if (!region) {
warn() << "SoftMMU::write64: No region for @" << (const void*)address.offset();
warnf("SoftMMU::write64: No region for @ {:p}", address.offset());
TODO();
}

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Format.h>
#include <AK/Platform.h>
#pragma once
@ -160,3 +161,11 @@ inline void ValueAndShadowReference<T>::operator=(const ValueWithShadow<T>& othe
}
}
template<typename T>
struct AK::Formatter<UserspaceEmulator::ValueWithShadow<T>> : AK::Formatter<T> {
void format(StringBuilder& builder, UserspaceEmulator::ValueWithShadow<T> value, FormatterContext& context)
{
return Formatter<T>::format(builder, value.value(), context);
}
};