1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2010-2016, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef LOCAL_DEBUGGER_INTERFACE_H 7 #define LOCAL_DEBUGGER_INTERFACE_H 8 9 #include "DebuggerInterface.h" 10 11 12 class LocalDebuggerInterface : public DebuggerInterface { 13 public: 14 LocalDebuggerInterface(team_id team); 15 virtual ~LocalDebuggerInterface(); 16 17 virtual status_t Init(); 18 virtual void Close(bool killTeam); 19 20 virtual bool Connected() const; 21 22 virtual team_id TeamID() const; 23 24 virtual Architecture* GetArchitecture() const; 25 26 virtual status_t GetNextDebugEvent(DebugEvent*& _event); 27 28 virtual status_t SetTeamDebuggingFlags(uint32 flags); 29 30 virtual status_t ContinueThread(thread_id thread); 31 virtual status_t StopThread(thread_id thread); 32 virtual status_t SingleStepThread(thread_id thread); 33 34 virtual status_t InstallBreakpoint(target_addr_t address); 35 virtual status_t UninstallBreakpoint(target_addr_t address); 36 37 virtual status_t InstallWatchpoint(target_addr_t address, 38 uint32 type, int32 length); 39 virtual status_t UninstallWatchpoint(target_addr_t address); 40 41 virtual status_t GetSystemInfo(SystemInfo& info); 42 virtual status_t GetTeamInfo(TeamInfo& info); 43 virtual status_t GetThreadInfos(BObjectList<ThreadInfo>& infos); 44 virtual status_t GetImageInfos(BObjectList<ImageInfo>& infos); 45 virtual status_t GetAreaInfos(BObjectList<AreaInfo>& infos); 46 virtual status_t GetSemaphoreInfos( 47 BObjectList<SemaphoreInfo>& infos); 48 virtual status_t GetSymbolInfos(team_id team, image_id image, 49 BObjectList<SymbolInfo>& infos); 50 virtual status_t GetSymbolInfo(team_id team, image_id image, 51 const char* name, int32 symbolType, 52 SymbolInfo& info); 53 54 virtual status_t GetThreadInfo(thread_id thread, 55 ThreadInfo& info); 56 virtual status_t GetCpuState(thread_id thread, 57 CpuState*& _state); 58 // returns a reference to the caller 59 virtual status_t SetCpuState(thread_id thread, 60 const CpuState* state); 61 62 virtual status_t GetCpuFeatures(uint32& flags); 63 64 virtual status_t WriteCoreFile(const char* path); 65 66 // TeamMemory 67 virtual status_t GetMemoryProperties(target_addr_t address, 68 uint32& protection, uint32& locking); 69 70 virtual ssize_t ReadMemory(target_addr_t address, void* buffer, 71 size_t size); 72 virtual ssize_t WriteMemory(target_addr_t address, 73 void* buffer, size_t size); 74 75 private: 76 struct DebugContext; 77 struct DebugContextPool; 78 struct DebugContextGetter; 79 80 private: 81 status_t _CreateDebugEvent(int32 messageCode, 82 const debug_debugger_message_data& message, 83 bool& _ignore, DebugEvent*& _event); 84 85 status_t _GetNextSystemWatchEvent(DebugEvent*& _event, 86 BPrivate::KMessage& message); 87 88 status_t _GetDebugCpuState(thread_id thread, 89 debug_cpu_state& _state); 90 91 private: 92 team_id fTeamID; 93 port_id fDebuggerPort; 94 port_id fNubPort; 95 DebugContextPool* fDebugContextPool; 96 Architecture* fArchitecture; 97 }; 98 99 #endif // DEBUGGER_INTERFACE_H 100