diff --git a/Userland/Applications/Debugger/CMakeLists.txt b/Userland/Applications/Debugger/CMakeLists.txt index 2548c51ebe..47a667ad4e 100644 --- a/Userland/Applications/Debugger/CMakeLists.txt +++ b/Userland/Applications/Debugger/CMakeLists.txt @@ -8,4 +8,4 @@ set(SOURCES ) serenity_bin(Debugger) -target_link_libraries(Debugger LibCore LibDebug LibX86 LibLine) +target_link_libraries(Debugger LibCore LibDebug LibLine LibMain LibX86) diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index 89214b5fa3..d62a39a2df 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Itamar S. + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -9,11 +10,14 @@ #include #include #include +#include #include #include +#include #include #include #include +#include #include #include #include @@ -204,21 +208,18 @@ static void print_help() "x
- examine dword in memory\n"); } -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { editor = Line::Editor::construct(); - if (pledge("stdio proc ptrace exec rpath tty sigaction cpath unix", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio proc ptrace exec rpath tty sigaction cpath unix", nullptr)); const char* command = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(command, "The program to be debugged, along with its arguments", "program", Core::ArgsParser::Required::Yes); - args_parser.parse(argc, argv); + args_parser.parse(arguments); auto result = Debug::DebugSession::exec_and_attach(command); if (!result) { @@ -230,7 +231,7 @@ int main(int argc, char** argv) struct sigaction sa { }; sa.sa_handler = handle_sigint; - sigaction(SIGINT, &sa, nullptr); + TRY(Core::System::sigaction(SIGINT, &sa, nullptr)); Debug::DebugInfo::SourcePosition previous_source_position; bool in_step_line = false; @@ -331,4 +332,6 @@ int main(int argc, char** argv) return decision.value(); } }); + + return 0; }