Skip to content

Commit

Permalink
CrashReporter: Show termination signal
Browse files Browse the repository at this point in the history
...in both text (using strsignal) and numeric form.
Closes SerenityOS#4775.
  • Loading branch information
linusg authored and awesomekling committed Jan 3, 2021
1 parent 0571a17 commit bf45a28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Applications/CrashReporter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <LibGUI/LinkLabel.h>
#include <LibGUI/TextEditor.h>
#include <LibGUI/Window.h>
#include <string.h>

static String build_backtrace(const CoreDump::Reader& coredump)
{
Expand Down Expand Up @@ -87,6 +88,7 @@ int main(int argc, char** argv)
String backtrace;
String executable_path;
int pid { 0 };
u8 termination_signal { 0 };

{
auto coredump = CoreDump::Reader::create(coredump_path);
Expand All @@ -98,6 +100,7 @@ int main(int argc, char** argv)
backtrace = build_backtrace(*coredump);
executable_path = String(process_info.executable_path);
pid = process_info.pid;
termination_signal = process_info.termination_signal;
}

auto app = GUI::Application::construct(argc, argv);
Expand Down Expand Up @@ -147,7 +150,7 @@ int main(int argc, char** argv)
app_name = af->name();

auto& description_label = *widget.find_descendant_of_type_named<GUI::Label>("description");
description_label.set_text(String::formatted("\"{}\" (PID {}) has crashed!", app_name, pid));
description_label.set_text(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal));

auto& executable_link_label = *widget.find_descendant_of_type_named<GUI::LinkLabel>("executable_link");
executable_link_label.set_text(LexicalPath::canonicalized_path(executable_path));
Expand Down

0 comments on commit bf45a28

Please sign in to comment.