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