diff --git a/Applications/CrashReporter/main.cpp b/Applications/CrashReporter/main.cpp index 4e03a8ecb2..815fec911d 100644 --- a/Applications/CrashReporter/main.cpp +++ b/Applications/CrashReporter/main.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,7 @@ int main(int argc, char** argv) args_parser.parse(argc, argv); Optional backtrace; + String executable_path; { auto coredump = CoreDump::Reader::create(coredump_path); @@ -67,7 +69,9 @@ int main(int argc, char** argv) warnln("Could not open coredump '{}'", coredump_path); return 1; } + auto& process_info = coredump->process_info(); backtrace = coredump->backtrace(); + executable_path = String(process_info.executable_path); } auto app = GUI::Application::construct(argc, argv); @@ -77,18 +81,6 @@ int main(int argc, char** argv) return 1; } - String executable_path; - // FIXME: Maybe we should just embed the process's executable path - // in the coredump by itself so we don't have to extract it from the backtrace. - // Such a process section could also include the PID, which currently we'd have - // to parse from the filename. - if (!backtrace.value().entries().is_empty()) { - executable_path = backtrace.value().entries().last().object_name; - } else { - warnln("Could not determine executable path from coredump"); - return 1; - } - if (unveil(executable_path.characters(), "r") < 0) { perror("unveil"); return 1;