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