mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 02:30:30 +09:00
UserspaceEmulator: Use a report() function instead of dbgprintf()
Ultimately we'll want to make it a bit easier to add more reporting. This at least makes it easier to redirect the logging.
This commit is contained in:
parent
628b3badfb
commit
c7e4c0734b
Notes:
sideshowbarker
2024-07-19 04:26:23 +09:00
Author: https://github.com/awesomekling
Commit: c7e4c0734b
4 changed files with 40 additions and 30 deletions
|
@ -225,10 +225,10 @@ void Emulator::dump_backtrace(const Vector<FlatPtr>& backtrace)
|
|||
u32 offset = 0;
|
||||
String symbol = m_elf->symbolicate(address, &offset);
|
||||
auto source_position = m_debug_info->get_source_position(address);
|
||||
dbgprintf("==%d== %#08x %s +%#x", getpid(), address, symbol.characters(), offset);
|
||||
report("==%d== %#08x %s +%#x", getpid(), address, symbol.characters(), offset);
|
||||
if (source_position.has_value())
|
||||
dbgprintf(" (\033[34;1m%s\033[0m:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number);
|
||||
dbgprintf("\n");
|
||||
report(" (\033[34;1m%s\033[0m:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number);
|
||||
report("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -844,7 +844,7 @@ u32 Emulator::virt$read(int fd, FlatPtr buffer, ssize_t size)
|
|||
|
||||
void Emulator::virt$exit(int status)
|
||||
{
|
||||
dbgprintf("\n==%d== \033[33;1mSyscall: exit(%d)\033[0m, shutting down!\n", getpid(), status);
|
||||
report("\n==%d== \033[33;1mSyscall: exit(%d)\033[0m, shutting down!\n", getpid(), status);
|
||||
m_exit_status = status;
|
||||
m_shutdown = true;
|
||||
}
|
||||
|
@ -911,10 +911,10 @@ int Emulator::virt$execve(FlatPtr params_addr)
|
|||
copy_string_list(arguments, params.arguments);
|
||||
copy_string_list(environment, params.environment);
|
||||
|
||||
dbgprintf("\n");
|
||||
dbgprintf("==%d== \033[33;1mSyscall:\033[0m execve\n", getpid());
|
||||
report("\n");
|
||||
report("==%d== \033[33;1mSyscall:\033[0m execve\n", getpid());
|
||||
for (auto& argument : arguments)
|
||||
dbgprintf("==%d== - %s\n", getpid(), argument.characters());
|
||||
report("==%d== - %s\n", getpid(), argument.characters());
|
||||
|
||||
Vector<char*> argv;
|
||||
Vector<char*> envp;
|
||||
|
@ -981,4 +981,12 @@ int Emulator::virt$gethostname(FlatPtr buffer, ssize_t buffer_size)
|
|||
return rc;
|
||||
}
|
||||
|
||||
void report(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue