vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / user_interface / UserInterface.h
blob17a7a163329345e4f993c0588bde8ba129818007
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013-2016, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef USER_INTERFACE_H
7 #define USER_INTERFACE_H
10 #include <OS.h>
12 #include <Referenceable.h>
14 #include "TeamMemoryBlock.h"
15 #include "Types.h"
18 class entry_ref;
20 class CpuState;
21 class ExpressionInfo;
22 class FunctionInstance;
23 class Image;
24 class LocatableFile;
25 class SourceLanguage;
26 class StackFrame;
27 class Team;
28 class TeamUiSettings;
29 class Thread;
30 class TypeComponentPath;
31 class UserBreakpoint;
32 class UserInterfaceListener;
33 class Value;
34 class ValueNode;
35 class ValueNodeContainer;
36 class Watchpoint;
39 enum user_notification_type {
40 USER_NOTIFICATION_INFO,
41 USER_NOTIFICATION_WARNING,
42 USER_NOTIFICATION_ERROR
46 class UserInterface : public BReferenceable {
47 public:
48 virtual ~UserInterface();
50 virtual const char* ID() const = 0;
52 virtual status_t Init(Team* team,
53 UserInterfaceListener* listener) = 0;
54 virtual void Show() = 0;
55 virtual void Terminate() = 0;
56 // shut down the UI *now* -- no more user
57 // feedback
59 virtual UserInterface* Clone() const = 0;
60 // returns a new instance of the
61 // appropriate user interface subclass.
62 // primarily needed in order to
63 // reconstruct the necessary information
64 // for initiating a team restart.
66 virtual bool IsInteractive() const = 0;
68 virtual status_t LoadSettings(const TeamUiSettings* settings)
69 = 0;
70 virtual status_t SaveSettings(TeamUiSettings*& settings)
71 const = 0;
73 virtual void NotifyUser(const char* title,
74 const char* message,
75 user_notification_type type) = 0;
76 virtual void NotifyBackgroundWorkStatus(const char* message)
77 = 0;
78 // this is used to inform the user about
79 // background processing work, but doesn't
80 // otherwise require any form of
81 // user interaction, i.e. for a status bar
82 // to indicate that debug information is
83 // being parsed.
85 virtual int32 SynchronouslyAskUser(const char* title,
86 const char* message, const char* choice1,
87 const char* choice2, const char* choice3)
88 = 0;
89 // returns -1, if not implemented or user
90 // cannot be asked
92 virtual status_t SynchronouslyAskUserForFile(entry_ref* _ref)
93 = 0;
97 class UserInterfaceListener {
98 public:
99 enum QuitOption {
100 QUIT_OPTION_ASK_USER,
101 QUIT_OPTION_ASK_KILL_TEAM,
102 QUIT_OPTION_ASK_RESUME_TEAM
105 public:
106 virtual ~UserInterfaceListener();
108 virtual void FunctionSourceCodeRequested(
109 FunctionInstance* function,
110 bool forceDisassembly = false) = 0;
111 virtual void SourceEntryLocateRequested(
112 const char* sourcePath,
113 const char* locatedPath) = 0;
114 virtual void SourceEntryInvalidateRequested(
115 LocatableFile* sourceFile) = 0;
116 virtual void ImageDebugInfoRequested(Image* image) = 0;
117 virtual void ValueNodeValueRequested(CpuState* cpuState,
118 ValueNodeContainer* container,
119 ValueNode* valueNode) = 0;
120 virtual void ValueNodeWriteRequested(ValueNode* node,
121 CpuState* state, Value* newValue) = 0;
122 virtual void ThreadActionRequested(thread_id threadID,
123 uint32 action,
124 target_addr_t address = 0) = 0;
126 virtual void SetBreakpointRequested(target_addr_t address,
127 bool enabled, bool hidden = false) = 0;
128 virtual void SetBreakpointEnabledRequested(
129 UserBreakpoint* breakpoint,
130 bool enabled) = 0;
131 virtual void SetBreakpointConditionRequested(
132 UserBreakpoint* breakpoint,
133 const char* condition) = 0;
134 virtual void ClearBreakpointConditionRequested(
135 UserBreakpoint* breakpoint) = 0;
136 virtual void ClearBreakpointRequested(
137 target_addr_t address) = 0;
138 virtual void ClearBreakpointRequested(
139 UserBreakpoint* breakpoint) = 0;
140 // TODO: Consolidate those!
142 virtual void SetStopOnImageLoadRequested(bool enabled,
143 bool useImageNames) = 0;
144 virtual void AddStopImageNameRequested(
145 const char* name) = 0;
146 virtual void RemoveStopImageNameRequested(
147 const char* name) = 0;
149 virtual void SetDefaultSignalDispositionRequested(
150 int32 disposition) = 0;
151 virtual void SetCustomSignalDispositionRequested(
152 int32 signal, int32 disposition) = 0;
153 virtual void RemoveCustomSignalDispositionRequested(
154 int32 signal) = 0;
156 virtual void SetWatchpointRequested(target_addr_t address,
157 uint32 type, int32 length,
158 bool enabled) = 0;
159 virtual void SetWatchpointEnabledRequested(
160 Watchpoint* watchpoint,
161 bool enabled) = 0;
162 virtual void ClearWatchpointRequested(
163 target_addr_t address) = 0;
164 virtual void ClearWatchpointRequested(
165 Watchpoint* watchpoint) = 0;
167 virtual void InspectRequested(
168 target_addr_t address,
169 TeamMemoryBlock::Listener* listener) = 0;
170 virtual void MemoryWriteRequested(
171 target_addr_t address,
172 const void* data,
173 target_size_t length) = 0;
175 virtual void ExpressionEvaluationRequested(
176 SourceLanguage* language,
177 ExpressionInfo* info,
178 StackFrame* frame = NULL,
179 ::Thread* thread = NULL) = 0;
181 virtual void DebugReportRequested(entry_ref* path) = 0;
183 virtual void WriteCoreFileRequested(entry_ref* path) = 0;
185 virtual void TeamRestartRequested() = 0;
187 virtual bool UserInterfaceQuitRequested(
188 QuitOption quitOption
189 = QUIT_OPTION_ASK_USER) = 0;
193 #endif // USER_INTERFACE_H