1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2010-2013, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef TEAM_WINDOW_H 7 #define TEAM_WINDOW_H 8 9 10 #include <String.h> 11 #include <Window.h> 12 13 #include "BreakpointsView.h" 14 #include "Function.h" 15 #include "GuiTeamUiSettings.h" 16 #include "ImageFunctionsView.h" 17 #include "ImageListView.h" 18 #include "SourceView.h" 19 #include "StackFrame.h" 20 #include "StackTraceView.h" 21 #include "Team.h" 22 #include "ThreadListView.h" 23 #include "VariablesView.h" 24 25 26 class BButton; 27 class BFilePanel; 28 class BMenuBar; 29 class BMessageRunner; 30 class BSplitView; 31 class BStringView; 32 class BTabView; 33 class ConsoleOutputView; 34 class BreakConditionConfigWindow; 35 class Image; 36 class InspectorWindow; 37 class RegistersView; 38 class SourceCode; 39 class StackFrame; 40 class UserBreakpoint; 41 class UserInterfaceListener; 42 class VariablesView; 43 44 45 class TeamWindow : public BWindow, ThreadListView::Listener, 46 ImageListView::Listener, StackTraceView::Listener, 47 ImageFunctionsView::Listener, BreakpointsView::Listener, 48 SourceView::Listener, VariablesView::Listener, Team::Listener, 49 Function::Listener, StackFrame::Listener { 50 public: 51 TeamWindow(::Team* team, 52 UserInterfaceListener* listener); 53 ~TeamWindow(); 54 55 static TeamWindow* Create(::Team* team, 56 UserInterfaceListener* listener); 57 // throws 58 59 virtual void DispatchMessage(BMessage* message, 60 BHandler* handler); 61 virtual void MessageReceived(BMessage* message); 62 virtual bool QuitRequested(); 63 64 status_t LoadSettings( 65 const GuiTeamUiSettings* settings); 66 status_t SaveSettings( 67 GuiTeamUiSettings* settings); 68 69 70 private: 71 enum ActiveSourceObject { 72 ACTIVE_SOURCE_NONE, 73 ACTIVE_SOURCE_STACK_FRAME, 74 ACTIVE_SOURCE_FUNCTION, 75 ACTIVE_SOURCE_BREAKPOINT 76 }; 77 78 private: 79 // ThreadListView::Listener 80 virtual void ThreadSelectionChanged(::Thread* thread); 81 82 // ImageListView::Listener 83 virtual void ImageSelectionChanged(Image* image); 84 85 // StackTraceView::Listener 86 virtual void StackFrameSelectionChanged(StackFrame* frame); 87 88 // ImageFunctionsView::Listener 89 virtual void FunctionSelectionChanged( 90 FunctionInstance* function); 91 92 // BreakpointsView::Listener 93 virtual void BreakpointSelectionChanged( 94 BreakpointProxyList& proxies); 95 virtual void SetBreakpointEnabledRequested( 96 UserBreakpoint* breakpoint, 97 bool enabled); 98 virtual void ClearBreakpointRequested( 99 UserBreakpoint* breakpoint); 100 101 virtual void SetWatchpointEnabledRequested( 102 Watchpoint* breakpoint, 103 bool enabled); 104 virtual void ClearWatchpointRequested( 105 Watchpoint* watchpoint); 106 107 108 // SourceView::Listener 109 virtual void SetBreakpointRequested(target_addr_t address, 110 bool enabled); 111 virtual void ClearBreakpointRequested( 112 target_addr_t address); 113 virtual void ThreadActionRequested(::Thread* thread, 114 uint32 action, target_addr_t address); 115 virtual void FunctionSourceCodeRequested( 116 FunctionInstance* function, 117 bool forceDisassembly); 118 119 120 // VariablesView::Listener 121 virtual void ValueNodeValueRequested(CpuState* cpuState, 122 ValueNodeContainer* container, 123 ValueNode* valueNode); 124 125 // Team::Listener 126 virtual void ThreadStateChanged( 127 const Team::ThreadEvent& event); 128 virtual void ThreadCpuStateChanged( 129 const Team::ThreadEvent& event); 130 virtual void ThreadStackTraceChanged( 131 const Team::ThreadEvent& event); 132 virtual void ImageDebugInfoChanged( 133 const Team::ImageEvent& event); 134 virtual void ConsoleOutputReceived( 135 const Team::ConsoleOutputEvent& event); 136 virtual void UserBreakpointChanged( 137 const Team::UserBreakpointEvent& event); 138 virtual void WatchpointChanged( 139 const Team::WatchpointEvent& event); 140 virtual void DebugReportChanged( 141 const Team::DebugReportEvent& event); 142 143 // Function::Listener 144 virtual void FunctionSourceCodeChanged(Function* function); 145 146 void _Init(); 147 148 void _SetActiveThread(::Thread* thread); 149 void _SetActiveImage(Image* image); 150 void _SetActiveStackTrace(StackTrace* stackTrace); 151 void _SetActiveStackFrame(StackFrame* frame); 152 void _SetActiveBreakpoint( 153 UserBreakpoint* breakpoint); 154 void _SetActiveFunction(FunctionInstance* function); 155 void _SetActiveSourceCode(SourceCode* sourceCode); 156 void _UpdateCpuState(); 157 void _UpdateRunButtons(); 158 void _UpdateSourcePathState(); 159 void _ScrollToActiveFunction(); 160 161 void _HandleThreadStateChanged(thread_id threadID); 162 void _HandleCpuStateChanged(thread_id threadID); 163 void _HandleStackTraceChanged(thread_id threadID); 164 void _HandleImageDebugInfoChanged(image_id imageID); 165 void _HandleSourceCodeChanged(); 166 void _HandleUserBreakpointChanged( 167 UserBreakpoint* breakpoint); 168 void _HandleWatchpointChanged( 169 Watchpoint* watchpoint); 170 void _HandleResolveMissingSourceFile(entry_ref& 171 locatedPath); 172 173 status_t _SaveInspectorSettings( 174 const BMessage* settings); 175 private: 176 ::Team* fTeam; 177 ::Thread* fActiveThread; 178 Image* fActiveImage; 179 StackTrace* fActiveStackTrace; 180 StackFrame* fActiveStackFrame; 181 UserBreakpoint* fActiveBreakpoint; 182 FunctionInstance* fActiveFunction; 183 SourceCode* fActiveSourceCode; 184 ActiveSourceObject fActiveSourceObject; 185 UserInterfaceListener* fListener; 186 BMessageRunner* fTraceUpdateRunner; 187 BTabView* fTabView; 188 BTabView* fLocalsTabView; 189 ThreadListView* fThreadListView; 190 ImageListView* fImageListView; 191 ImageFunctionsView* fImageFunctionsView; 192 BreakpointsView* fBreakpointsView; 193 VariablesView* fVariablesView; 194 RegistersView* fRegistersView; 195 StackTraceView* fStackTraceView; 196 SourceView* fSourceView; 197 BButton* fRunButton; 198 BButton* fStepOverButton; 199 BButton* fStepIntoButton; 200 BButton* fStepOutButton; 201 BMenuBar* fMenuBar; 202 BStringView* fSourcePathView; 203 ConsoleOutputView* fConsoleOutputView; 204 BSplitView* fFunctionSplitView; 205 BSplitView* fSourceSplitView; 206 BSplitView* fImageSplitView; 207 BSplitView* fThreadSplitView; 208 BSplitView* fConsoleSplitView; 209 BreakConditionConfigWindow* fBreakConditionConfigWindow; 210 InspectorWindow* fInspectorWindow; 211 GuiTeamUiSettings fUiSettings; 212 BFilePanel* fFilePanel; 213 }; 214 215 216 #endif // TEAM_WINDOW_H 217