mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:47:35 +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
|
@ -82,6 +82,13 @@
|
||||||
|
|
||||||
layout: @GUI::HorizontalBoxLayout
|
layout: @GUI::HorizontalBoxLayout
|
||||||
|
|
||||||
|
@GUI::Button {
|
||||||
|
name: "inspect_button"
|
||||||
|
text: "Inspect in Hack Studio"
|
||||||
|
fixed_width: 150
|
||||||
|
fixed_height: 22
|
||||||
|
}
|
||||||
|
|
||||||
// HACK: We need something like Layout::add_spacer() in GML! :^)
|
// HACK: We need something like Layout::add_spacer() in GML! :^)
|
||||||
@GUI::Widget
|
@GUI::Widget
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
|
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
|
||||||
|
#include <LibC/serenity.h>
|
||||||
|
#include <LibC/spawn.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibCoredump/Backtrace.h>
|
#include <LibCoredump/Backtrace.h>
|
||||||
|
@ -164,7 +166,7 @@ static void unlink_coredump(StringView const& coredump_path)
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
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");
|
perror("pledge");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +213,7 @@ int main(int argc, char** argv)
|
||||||
termination_signal = coredump->process_termination_signal();
|
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");
|
perror("pledge");
|
||||||
return 1;
|
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) {
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
perror("unveil");
|
perror("unveil");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -344,6 +351,19 @@ int main(int argc, char** argv)
|
||||||
app->quit();
|
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();
|
window->show();
|
||||||
|
|
||||||
return app->exec();
|
return app->exec();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue