mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
UserspaceEmulator: Remove remaining printf calls.
This commit is contained in:
parent
d5ffb51a83
commit
e089855af0
Notes:
sideshowbarker
2024-07-19 02:04:21 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/e089855af0d Pull-request: https://github.com/SerenityOS/serenity/pull/3680
4 changed files with 6 additions and 17 deletions
|
@ -217,12 +217,11 @@ 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);
|
||||
report("==%d== %#08x %s", getpid(), address, symbol.characters());
|
||||
new_warn("=={}== {:p} {}", getpid(), address, symbol);
|
||||
if (source_position.has_value())
|
||||
report(" (\033[34;1m%s\033[0m:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number);
|
||||
warnln(" (\033[34;1m{}\033[0m:{})", LexicalPath(source_position.value().file_path).basename(), source_position.value().line_number);
|
||||
else
|
||||
report(" +%#x", offset);
|
||||
report("\n");
|
||||
warnln(" +{:x}", offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,7 +896,7 @@ u32 Emulator::virt$read(int fd, FlatPtr buffer, ssize_t size)
|
|||
|
||||
void Emulator::virt$exit(int status)
|
||||
{
|
||||
report("\n==%d== \033[33;1mSyscall: exit(%d)\033[0m, shutting down!\n", getpid(), status);
|
||||
warnln("\n=={}== \033[33;1mSyscall: exit({})\033[0m, shutting down!", getpid(), status);
|
||||
m_exit_status = status;
|
||||
m_shutdown = true;
|
||||
}
|
||||
|
@ -1239,14 +1238,6 @@ void Emulator::dispatch_one_pending_signal()
|
|||
m_cpu.set_eip(m_signal_trampoline);
|
||||
}
|
||||
|
||||
void report(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
// Make sure the compiler doesn't "optimize away" this function:
|
||||
extern void signal_trampoline_dummy(void);
|
||||
void signal_trampoline_dummy(void)
|
||||
|
|
|
@ -171,6 +171,4 @@ private:
|
|||
FlatPtr m_signal_trampoline { 0 };
|
||||
};
|
||||
|
||||
void report(const char*, ...);
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define TODO_INSN() \
|
||||
do { \
|
||||
report("\n==%d== Unimplemented instruction: %s\n", getpid(), __FUNCTION__); \
|
||||
warnln("\n=={}== Unimplemented instruction: {}\n", getpid(), __FUNCTION__); \
|
||||
m_emulator.dump_backtrace(); \
|
||||
_exit(0); \
|
||||
} while (0)
|
||||
|
|
|
@ -78,7 +78,7 @@ int main(int argc, char** argv, char** env)
|
|||
}
|
||||
int rc = pthread_setname_np(pthread_self(), builder.to_string().characters());
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "pthread_setname_np: %s\n", strerror(rc));
|
||||
warnln("pthread_setname_np: {}", strerror(rc));
|
||||
return 1;
|
||||
}
|
||||
return emulator.exec();
|
||||
|
|
Loading…
Reference in a new issue