1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

UserspaceEmulator: Optionally write reports to the debug log

...and take a flag '--report-to-debug' that determines this behaviour.
This commit is contained in:
AnotherTest 2020-10-24 11:15:51 +03:30 committed by Andreas Kling
parent 201d34f6cd
commit 9afe9069a9
8 changed files with 118 additions and 70 deletions

View file

@ -37,11 +37,14 @@
#include <pthread.h>
#include <string.h>
bool g_report_to_debug = false;
int main(int argc, char** argv, char** env)
{
Vector<const char*> command;
Core::ArgsParser parser;
parser.add_option(g_report_to_debug, "Write reports to the debug log", "report-to-debug", 0);
parser.add_positional_argument(command, "Command to emulate", "command");
parser.parse(argc, argv);
@ -49,7 +52,7 @@ int main(int argc, char** argv, char** env)
MappedFile mapped_file(executable_path);
if (!mapped_file.is_valid()) {
warnln("Unable to map {}", executable_path);
reportln("Unable to map {}", executable_path);
return 1;
}
@ -78,7 +81,7 @@ int main(int argc, char** argv, char** env)
}
int rc = pthread_setname_np(pthread_self(), builder.to_string().characters());
if (rc != 0) {
warnln("pthread_setname_np: {}", strerror(rc));
reportln("pthread_setname_np: {}", strerror(rc));
return 1;
}
return emulator.exec();