mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:58:12 +00:00
CrashReporter: Read executable path from coredump process info
We no longer have to look at the backtrace and guess the executable, it's now embedded in the coredump's ProcessInfo notes entry directly. Fixes #4645.
This commit is contained in:
parent
6fe6e0a36a
commit
bde65ba7ca
1 changed files with 4 additions and 12 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <LibCoreDump/Reader.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibELF/CoreDump.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
|
@ -60,6 +61,7 @@ int main(int argc, char** argv)
|
|||
args_parser.parse(argc, argv);
|
||||
|
||||
Optional<CoreDump::Backtrace> 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue