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