1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2010, 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 "ImageFunctionsView.h" 16 #include "ImageListView.h" 17 #include "SourceView.h" 18 #include "StackFrame.h" 19 #include "StackTraceView.h" 20 #include "Team.h" 21 #include "ThreadListView.h" 22 #include "VariablesView.h" 23 24 25 class BButton; 26 class BMenuBar; 27 class BStringView; 28 class BTabView; 29 class Image; 30 class RegistersView; 31 class SourceCode; 32 class StackFrame; 33 class UserBreakpoint; 34 class UserInterfaceListener; 35 class VariablesView; 36 37 38 class TeamWindow : public BWindow, ThreadListView::Listener, 39 ImageListView::Listener, StackTraceView::Listener, 40 ImageFunctionsView::Listener, BreakpointsView::Listener, 41 SourceView::Listener, VariablesView::Listener, Team::Listener, 42 Function::Listener, StackFrame::Listener { 43 public: 44 TeamWindow(::Team* team, 45 UserInterfaceListener* listener); 46 ~TeamWindow(); 47 48 static TeamWindow* Create(::Team* team, 49 UserInterfaceListener* listener); 50 // throws 51 52 virtual void DispatchMessage(BMessage* message, 53 BHandler* handler); 54 virtual void MessageReceived(BMessage* message); 55 virtual bool QuitRequested(); 56 57 private: 58 enum ActiveSourceObject { 59 ACTIVE_SOURCE_NONE, 60 ACTIVE_SOURCE_STACK_FRAME, 61 ACTIVE_SOURCE_FUNCTION, 62 ACTIVE_SOURCE_BREAKPOINT 63 }; 64 65 private: 66 // ThreadListView::Listener 67 virtual void ThreadSelectionChanged(::Thread* thread); 68 69 // ImageListView::Listener 70 virtual void ImageSelectionChanged(Image* image); 71 72 // StackTraceView::Listener 73 virtual void StackFrameSelectionChanged(StackFrame* frame); 74 75 // ImageFunctionsView::Listener 76 virtual void FunctionSelectionChanged( 77 FunctionInstance* function); 78 79 // BreakpointsView::Listener 80 virtual void BreakpointSelectionChanged( 81 UserBreakpoint* breakpoint); 82 virtual void SetBreakpointEnabledRequested( 83 UserBreakpoint* breakpoint, 84 bool enabled); 85 virtual void ClearBreakpointRequested( 86 UserBreakpoint* breakpoint); 87 88 // SourceView::Listener 89 virtual void SetBreakpointRequested(target_addr_t address, 90 bool enabled); 91 virtual void ClearBreakpointRequested(target_addr_t address); 92 93 // VariablesView::Listener 94 virtual void ValueNodeValueRequested(CpuState* cpuState, 95 ValueNodeContainer* container, 96 ValueNode* valueNode); 97 98 // Team::Listener 99 virtual void ThreadStateChanged( 100 const Team::ThreadEvent& event); 101 virtual void ThreadCpuStateChanged( 102 const Team::ThreadEvent& event); 103 virtual void ThreadStackTraceChanged( 104 const Team::ThreadEvent& event); 105 virtual void ImageDebugInfoChanged( 106 const Team::ImageEvent& event); 107 virtual void UserBreakpointChanged( 108 const Team::UserBreakpointEvent& event); 109 110 // Function::Listener 111 virtual void FunctionSourceCodeChanged(Function* function); 112 113 void _Init(); 114 115 void _SetActiveThread(::Thread* thread); 116 void _SetActiveImage(Image* image); 117 void _SetActiveStackTrace(StackTrace* stackTrace); 118 void _SetActiveStackFrame(StackFrame* frame); 119 void _SetActiveBreakpoint( 120 UserBreakpoint* breakpoint); 121 void _SetActiveFunction(FunctionInstance* function); 122 void _SetActiveSourceCode(SourceCode* sourceCode); 123 void _UpdateCpuState(); 124 void _UpdateRunButtons(); 125 void _ScrollToActiveFunction(); 126 127 void _HandleThreadStateChanged(thread_id threadID); 128 void _HandleCpuStateChanged(thread_id threadID); 129 void _HandleStackTraceChanged(thread_id threadID); 130 void _HandleImageDebugInfoChanged(image_id imageID); 131 void _HandleSourceCodeChanged(); 132 void _HandleUserBreakpointChanged( 133 UserBreakpoint* breakpoint); 134 void _HandleResolveMissingSourceFile(entry_ref& 135 locatedPath); 136 137 private: 138 ::Team* fTeam; 139 ::Thread* fActiveThread; 140 Image* fActiveImage; 141 StackTrace* fActiveStackTrace; 142 StackFrame* fActiveStackFrame; 143 UserBreakpoint* fActiveBreakpoint; 144 FunctionInstance* fActiveFunction; 145 SourceCode* fActiveSourceCode; 146 ActiveSourceObject fActiveSourceObject; 147 UserInterfaceListener* fListener; 148 BTabView* fTabView; 149 BTabView* fLocalsTabView; 150 ThreadListView* fThreadListView; 151 ImageListView* fImageListView; 152 ImageFunctionsView* fImageFunctionsView; 153 BreakpointsView* fBreakpointsView; 154 VariablesView* fVariablesView; 155 RegistersView* fRegistersView; 156 StackTraceView* fStackTraceView; 157 SourceView* fSourceView; 158 BButton* fRunButton; 159 BButton* fStepOverButton; 160 BButton* fStepIntoButton; 161 BButton* fStepOutButton; 162 BMenuBar* fMenuBar; 163 BStringView* fSourcePathView; 164 }; 165 166 167 #endif // TEAM_WINDOW_H 168