1 /* 2 * Copyright 2009-2016, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2010-2015, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef DEBUGGER_INTERFACE_H 7 #define DEBUGGER_INTERFACE_H 8 9 #include <debugger.h> 10 11 #include <debug_support.h> 12 #include <ObjectList.h> 13 14 #include "TeamMemory.h" 15 16 17 class Architecture; 18 class AreaInfo; 19 class CpuState; 20 class DebugEvent; 21 class ElfSymbolLookup; 22 class ImageInfo; 23 class SemaphoreInfo; 24 class SymbolInfo; 25 class SystemInfo; 26 class TeamInfo; 27 class ThreadInfo; 28 29 namespace BPrivate { 30 class KMessage; 31 } 32 33 34 class DebuggerInterface : public TeamMemory { 35 public: 36 virtual ~DebuggerInterface(); 37 38 virtual status_t Init() 39 = 0; 40 virtual void Close(bool killTeam) = 0; 41 42 virtual bool Connected() const = 0; 43 44 virtual bool IsPostMortem() const; 45 46 virtual team_id TeamID() const = 0; 47 48 virtual Architecture* GetArchitecture() const = 0; 49 50 virtual status_t GetNextDebugEvent(DebugEvent*& _event) = 0; 51 52 virtual status_t SetTeamDebuggingFlags(uint32 flags) = 0; 53 54 virtual status_t ContinueThread(thread_id thread) = 0; 55 virtual status_t StopThread(thread_id thread) = 0; 56 virtual status_t SingleStepThread(thread_id thread) = 0; 57 58 virtual status_t InstallBreakpoint(target_addr_t address) = 0; 59 virtual status_t UninstallBreakpoint(target_addr_t address) = 0; 60 61 virtual status_t InstallWatchpoint(target_addr_t address, 62 uint32 type, int32 length) = 0; 63 virtual status_t UninstallWatchpoint(target_addr_t address) = 0; 64 65 virtual status_t GetSystemInfo(SystemInfo& info) = 0; 66 virtual status_t GetTeamInfo(TeamInfo& info) = 0; 67 virtual status_t GetThreadInfos(BObjectList<ThreadInfo>& infos) 68 = 0; 69 virtual status_t GetImageInfos(BObjectList<ImageInfo>& infos) 70 = 0; 71 virtual status_t GetAreaInfos(BObjectList<AreaInfo>& infos) 72 = 0; 73 virtual status_t GetSemaphoreInfos( 74 BObjectList<SemaphoreInfo>& infos) 75 = 0; 76 77 virtual status_t GetSymbolInfos(team_id team, image_id image, 78 BObjectList<SymbolInfo>& infos) = 0; 79 virtual status_t GetSymbolInfo(team_id team, image_id image, 80 const char* name, int32 symbolType, 81 SymbolInfo& info) = 0; 82 83 virtual status_t GetThreadInfo(thread_id thread, 84 ThreadInfo& info) = 0; 85 virtual status_t GetCpuState(thread_id thread, 86 CpuState*& _state) = 0; 87 // returns a reference to the caller 88 virtual status_t SetCpuState(thread_id thread, 89 const CpuState* state) = 0; 90 91 virtual status_t GetCpuFeatures(uint32& flags) = 0; 92 93 virtual status_t WriteCoreFile(const char* path) = 0; 94 95 // TeamMemory 96 virtual status_t GetMemoryProperties(target_addr_t address, 97 uint32& protection, uint32& locking) = 0; 98 99 virtual ssize_t ReadMemory(target_addr_t address, void* buffer, 100 size_t size) = 0; 101 virtual ssize_t WriteMemory(target_addr_t address, 102 void* buffer, size_t size) = 0; 103 104 protected: 105 status_t GetElfSymbols(const char* filePath, 106 int64 textDelta, 107 BObjectList<SymbolInfo>& infos); 108 status_t GetElfSymbols(const void* symbolTable, 109 uint32 symbolCount, 110 uint32 symbolTableEntrySize, 111 const char* stringTable, 112 uint32 stringTableSize, bool is64Bit, 113 bool swappedByteOrder, int64 textDelta, 114 BObjectList<SymbolInfo>& infos); 115 status_t GetElfSymbols(ElfSymbolLookup* symbolLookup, 116 BObjectList<SymbolInfo>& infos); 117 118 private: 119 struct SymbolTableLookupSource; 120 }; 121 122 123 #endif // DEBUGGER_INTERFACE_H 124