diff options
author | Itamar <itamar8910@gmail.com> | 2023-02-19 22:12:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-24 19:09:27 +0100 |
commit | 91224d47d20ab149ddf41e681ea6367c50123323 (patch) | |
tree | 3697e6390231bda4a9c6604a9806763974fbc6d5 /Userland | |
parent | 6e5b1f5819d3161156d2b919183f1e2b6ed40658 (diff) | |
download | serenity-91224d47d20ab149ddf41e681ea6367c50123323.zip |
SystemMonitor: Add "Debug In HackStudio" action to process context menu
This action launches HackStudio with its debugger attached to the
selected process.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/SystemMonitor/main.cpp | 13 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index b08a07e984..6647943ec1 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -264,6 +264,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/bin/Profiler", "rx")); TRY(Core::System::unveil("/bin/Inspector", "rx")); + TRY(Core::System::unveil("/bin/HackStudio", "rx")); TRY(Core::System::unveil(nullptr, nullptr)); StringView args_tab = "processes"sv; @@ -385,6 +386,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }, &process_table_view); + auto debug_action = GUI::Action::create( + "Debug in HackStudio", { Mod_Ctrl, Key_D }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"sv)), [&](const GUI::Action&) { + pid_t pid = selected_id(ProcessModel::Column::PID); + if (pid == -1) + return; + auto pid_string = DeprecatedString::number(pid); + GUI::Process::spawn_or_show_error(window, "/bin/HackStudio"sv, Array { "--pid", pid_string.characters() }); + }, + &process_table_view); + HashMap<pid_t, NonnullRefPtr<GUI::Window>> process_windows; auto process_properties_action = GUI::CommonActions::make_properties_action( @@ -424,6 +435,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) process_context_menu->add_action(continue_action); process_context_menu->add_separator(); process_context_menu->add_action(profile_action); + process_context_menu->add_action(debug_action); process_context_menu->add_separator(); process_context_menu->add_action(process_properties_action); process_table_view.on_context_menu_request = [&]([[maybe_unused]] const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) { @@ -471,6 +483,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) stop_action->set_enabled(has_access); continue_action->set_enabled(has_access); profile_action->set_enabled(has_access); + debug_action->set_enabled(has_access); process_properties_action->set_enabled(has_access); }; diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 82470ece8f..71d9eb486c 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -1091,7 +1091,7 @@ void HackStudioWidget::initialize_debugger() }); GUI::Application::the()->event_loop().wake(); }, - [this](float progress) { + [](float progress) { if (GUI::Application::the()->active_window()) GUI::Application::the()->active_window()->set_progress(progress * 100); }); |