1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibCoreDump+CrashDaemon: Compress coredumps

Most coredumps contain large amounts of consecutive null bytes and as
such are a prime candidate for compression.

This commit makes CrashDaemon compress files once the kernel finishes
emitting them, as well as adds the functionality needed in LibCoreDump
to then parse them.
This commit is contained in:
Idan Horowitz 2021-03-26 18:46:20 +03:00 committed by Andreas Kling
parent b8f462a78b
commit 9f656b6fa9
8 changed files with 70 additions and 15 deletions

View file

@ -30,6 +30,7 @@
#include <AK/URL.h>
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCoreDump/Backtrace.h>
#include <LibCoreDump/Reader.h>
#include <LibDesktop/AppFile.h>
@ -118,10 +119,12 @@ int main(int argc, char** argv)
}
const char* coredump_path = nullptr;
bool unlink_after_use = false;
Core::ArgsParser args_parser;
args_parser.set_general_help("Show information from an application crash coredump.");
args_parser.add_positional_argument(coredump_path, "Coredump path", "coredump-path");
args_parser.add_option(unlink_after_use, "Delete the coredump after its parsed", "unlink", 0);
args_parser.parse(argc, argv);
Vector<TitleAndText> thread_backtraces;
@ -155,6 +158,11 @@ int main(int argc, char** argv)
termination_signal = coredump->process_termination_signal();
}
if (unlink_after_use) {
if (Core::File::remove(coredump_path, Core::File::RecursionMode::Disallowed, false).is_error())
dbgln("Failed deleting coredump file");
}
auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio recvfd sendfd accept rpath unix", nullptr) < 0) {