xref: /aosp_15_r20/external/swiftshader/src/Vulkan/Debug/EventListener.hpp (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1 // Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef VK_DEBUG_EVENT_LISTENER_HPP_
16 #define VK_DEBUG_EVENT_LISTENER_HPP_
17 
18 #include "ID.hpp"
19 
20 #include <string>
21 
22 namespace vk {
23 namespace dbg {
24 
25 struct Location;
26 class Thread;
27 
28 // ServerEventListener is an interface that is used to listen for events raised
29 // by the server (the debugger).
30 class ServerEventListener
31 {
32 public:
33 	virtual ~ServerEventListener();
34 
35 	// onThreadStarted() is called when a new thread begins execution.
onThreadStarted(ID<Thread>)36 	virtual void onThreadStarted(ID<Thread>) {}
37 
38 	// onThreadStepped() is called when a thread performs a single line /
39 	// instruction step.
onThreadStepped(ID<Thread>)40 	virtual void onThreadStepped(ID<Thread>) {}
41 
42 	// onLineBreakpointHit() is called when a thread hits a line breakpoint and
43 	// pauses execution.
onLineBreakpointHit(ID<Thread>)44 	virtual void onLineBreakpointHit(ID<Thread>) {}
45 
46 	// onFunctionBreakpointHit() is called when a thread hits a function
47 	// breakpoint and pauses execution.
onFunctionBreakpointHit(ID<Thread>)48 	virtual void onFunctionBreakpointHit(ID<Thread>) {}
49 };
50 
51 // ClientEventListener is an interface that is used to listen for events raised
52 // by the client (the IDE).
53 class ClientEventListener
54 {
55 public:
56 	virtual ~ClientEventListener();
57 
58 	// onSetBreakpoint() is called when a breakpoint location is set.
onSetBreakpoint(const Location &,bool & handled)59 	virtual void onSetBreakpoint(const Location &, bool &handled) {}
60 
61 	// onSetBreakpoint() is called when a function breakpoint is set.
onSetBreakpoint(const std::string & func,bool & handled)62 	virtual void onSetBreakpoint(const std::string &func, bool &handled) {}
63 
64 	// onBreakpointsChange() is called after breakpoints have been changed.
onBreakpointsChanged()65 	virtual void onBreakpointsChanged() {}
66 };
67 
68 }  // namespace dbg
69 }  // namespace vk
70 
71 #endif  // VK_DEBUG_EVENT_LISTENER_HPP_
72