mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
CrashReporter: Add "Inspect in Hack Studio" button
This allows the user to open the crash coredump in Hack Studio and inspect it in the Debug tab.
This commit is contained in:
parent
8316eb7306
commit
dd76ba2fe1
2 changed files with 29 additions and 2 deletions
|
@ -10,6 +10,8 @@
|
|||
#include <AK/Types.h>
|
||||
#include <AK/URL.h>
|
||||
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
|
||||
#include <LibC/serenity.h>
|
||||
#include <LibC/spawn.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCoredump/Backtrace.h>
|
||||
|
@ -164,7 +166,7 @@ static void unlink_coredump(StringView const& coredump_path)
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (pledge("stdio recvfd sendfd cpath rpath unix", nullptr) < 0) {
|
||||
if (pledge("stdio recvfd sendfd cpath rpath unix proc exec", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
@ -211,7 +213,7 @@ int main(int argc, char** argv)
|
|||
termination_signal = coredump->process_termination_signal();
|
||||
}
|
||||
|
||||
if (pledge("stdio recvfd sendfd rpath unix cpath", nullptr) < 0) {
|
||||
if (pledge("stdio recvfd sendfd rpath unix cpath proc exec", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
@ -238,6 +240,11 @@ int main(int argc, char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (unveil("/bin/HackStudio", "rx") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil(nullptr, nullptr) < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
|
@ -344,6 +351,19 @@ int main(int argc, char** argv)
|
|||
app->quit();
|
||||
};
|
||||
|
||||
auto& inspect_button = *widget.find_descendant_of_type_named<GUI::Button>("inspect_button");
|
||||
inspect_button.set_icon(MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png")));
|
||||
inspect_button.on_click = [&](int) {
|
||||
pid_t child;
|
||||
const char* argv[4] = { "HackStudio", "-c", coredump_path, nullptr };
|
||||
if ((errno = posix_spawn(&child, "/bin/HackStudio", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(child) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
};
|
||||
|
||||
window->show();
|
||||
|
||||
return app->exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue