1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

HackStudio: Show local variables in the debugger

We now have a Debug Information tab, which displays the variables in
the current scope in a tree view.
This commit is contained in:
Itamar 2020-05-04 12:23:30 +03:00 committed by Andreas Kling
parent 09ac22b37f
commit 3dd0f755d0
6 changed files with 219 additions and 14 deletions

View file

@ -25,6 +25,7 @@
*/
#include "CursorTool.h"
#include "DebugInfoWidget.h"
#include "Debugger.h"
#include "Editor.h"
#include "EditorWrapper.h"
@ -508,6 +509,7 @@ int main(int argc, char** argv)
auto& find_in_files_widget = s_action_tab_widget->add_tab<FindInFilesWidget>("Find in files");
auto& terminal_wrapper = s_action_tab_widget->add_tab<TerminalWrapper>("Build", false);
auto& debug_info_widget = s_action_tab_widget->add_tab<DebugInfoWidget>("Debug");
auto& locator = widget.add<Locator>();
@ -602,12 +604,17 @@ int main(int argc, char** argv)
RefPtr<EditorWrapper> current_editor_in_execution;
Debugger::initialize(
[&](DebugInfo::SourcePosition source_position) {
[&](const PtraceRegisters& regs) {
dbg() << "Program stopped";
current_editor_in_execution = get_editor_of_file(source_position.file_path);
current_editor_in_execution->editor().set_execution_position(source_position.line_number - 1);
auto source_position = Debugger::the().session()->debug_info().get_source_position(regs.eip);
ASSERT(source_position.has_value());
current_editor_in_execution = get_editor_of_file(source_position.value().file_path);
current_editor_in_execution->editor().set_execution_position(source_position.value().line_number - 1);
debug_info_widget.update_variables(regs);
continue_action->set_enabled(true);
single_step_action->set_enabled(true);
reveal_action_tab(debug_info_widget);
},
[&]() {
dbg() << "Program continued";