mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:45:06 +00:00
UserspaceEmulator: Remove remaining printf calls.
This commit is contained in:
parent
d5ffb51a83
commit
e089855af0
4 changed files with 6 additions and 17 deletions
|
@ -217,12 +217,11 @@ void Emulator::dump_backtrace(const Vector<FlatPtr>& backtrace)
|
||||||
u32 offset = 0;
|
u32 offset = 0;
|
||||||
String symbol = m_elf->symbolicate(address, &offset);
|
String symbol = m_elf->symbolicate(address, &offset);
|
||||||
auto source_position = m_debug_info->get_source_position(address);
|
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())
|
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
|
else
|
||||||
report(" +%#x", offset);
|
warnln(" +{:x}", offset);
|
||||||
report("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,7 +896,7 @@ u32 Emulator::virt$read(int fd, FlatPtr buffer, ssize_t size)
|
||||||
|
|
||||||
void Emulator::virt$exit(int status)
|
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_exit_status = status;
|
||||||
m_shutdown = true;
|
m_shutdown = true;
|
||||||
}
|
}
|
||||||
|
@ -1239,14 +1238,6 @@ void Emulator::dispatch_one_pending_signal()
|
||||||
m_cpu.set_eip(m_signal_trampoline);
|
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:
|
// Make sure the compiler doesn't "optimize away" this function:
|
||||||
extern void signal_trampoline_dummy(void);
|
extern void signal_trampoline_dummy(void);
|
||||||
void signal_trampoline_dummy(void)
|
void signal_trampoline_dummy(void)
|
||||||
|
|
|
@ -171,6 +171,4 @@ private:
|
||||||
FlatPtr m_signal_trampoline { 0 };
|
FlatPtr m_signal_trampoline { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
void report(const char*, ...);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#define TODO_INSN() \
|
#define TODO_INSN() \
|
||||||
do { \
|
do { \
|
||||||
report("\n==%d== Unimplemented instruction: %s\n", getpid(), __FUNCTION__); \
|
warnln("\n=={}== Unimplemented instruction: {}\n", getpid(), __FUNCTION__); \
|
||||||
m_emulator.dump_backtrace(); \
|
m_emulator.dump_backtrace(); \
|
||||||
_exit(0); \
|
_exit(0); \
|
||||||
} while (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());
|
int rc = pthread_setname_np(pthread_self(), builder.to_string().characters());
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
fprintf(stderr, "pthread_setname_np: %s\n", strerror(rc));
|
warnln("pthread_setname_np: {}", strerror(rc));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return emulator.exec();
|
return emulator.exec();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue