summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h
blob: 0e3f06b628c5546a46eb09ff2b9132bec38df3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "Debugger.h"
#include <AK/NonnullOwnPtr.h>
#include <LibGUI/Action.h>
#include <LibGUI/ListView.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Model.h>
#include <LibGUI/TableView.h>
#include <LibGUI/Toolbar.h>
#include <LibGUI/ToolbarContainer.h>
#include <LibGUI/TreeView.h>
#include <LibGUI/Widget.h>
#include <sys/arch/i386/regs.h>

namespace HackStudio {

class DebugInfoWidget final : public GUI::Widget {
    C_OBJECT(DebugInfoWidget)
public:
    virtual ~DebugInfoWidget() override { }

    void update_state(Debug::ProcessInspector const&, PtraceRegisters const&);
    void program_stopped();
    void set_debug_actions_enabled(bool enabled);

private:
    explicit DebugInfoWidget();
    void init_toolbar();

    NonnullRefPtr<GUI::Widget> build_variables_tab();
    NonnullRefPtr<GUI::Widget> build_registers_tab();
    bool does_variable_support_writing(const Debug::DebugInfo::VariableInfo*);
    RefPtr<GUI::Menu> get_context_menu_for_variable(const GUI::ModelIndex&);

    RefPtr<GUI::TreeView> m_variables_view;
    RefPtr<GUI::TableView> m_registers_view;
    RefPtr<GUI::ListView> m_backtrace_view;
    RefPtr<GUI::Menu> m_variable_context_menu;
    RefPtr<GUI::Toolbar> m_toolbar;
    RefPtr<GUI::Action> m_continue_action;
    RefPtr<GUI::Action> m_singlestep_action;
    RefPtr<GUI::Action> m_step_in_action;
    RefPtr<GUI::Action> m_step_out_action;
};

}