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 namespace vk { 21 namespace dbg { 22 23 struct Location; 24 class Thread; 25 26 // ServerEventListener is an interface that is used to listen for events raised 27 // by the server (the debugger). 28 class ServerEventListener 29 { 30 public: 31 virtual ~ServerEventListener(); 32 33 // onThreadStarted() is called when a new thread begins execution. onThreadStarted(ID<Thread>)34 virtual void onThreadStarted(ID<Thread>) {} 35 36 // onThreadStepped() is called when a thread performs a single line / 37 // instruction step. onThreadStepped(ID<Thread>)38 virtual void onThreadStepped(ID<Thread>) {} 39 40 // onLineBreakpointHit() is called when a thread hits a line breakpoint and 41 // pauses execution. onLineBreakpointHit(ID<Thread>)42 virtual void onLineBreakpointHit(ID<Thread>) {} 43 44 // onFunctionBreakpointHit() is called when a thread hits a function 45 // breakpoint and pauses execution. onFunctionBreakpointHit(ID<Thread>)46 virtual void onFunctionBreakpointHit(ID<Thread>) {} 47 }; 48 49 // ClientEventListener is an interface that is used to listen for events raised 50 // by the client (the IDE). 51 class ClientEventListener 52 { 53 public: 54 virtual ~ClientEventListener(); 55 56 // onSetBreakpoint() is called when a breakpoint location is set. onSetBreakpoint(const Location &,bool & handled)57 virtual void onSetBreakpoint(const Location &, bool &handled) {} 58 59 // onSetBreakpoint() is called when a function breakpoint is set. onSetBreakpoint(const std::string & func,bool & handled)60 virtual void onSetBreakpoint(const std::string &func, bool &handled) {} 61 62 // onBreakpointsChange() is called after breakpoints have been changed. onBreakpointsChanged()63 virtual void onBreakpointsChanged() {} 64 }; 65 66 } // namespace dbg 67 } // namespace vk 68 69 #endif // VK_DEBUG_EVENT_LISTENER_HPP_ 70