xref: /haiku/headers/private/debug/DebugContext.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 /*
2  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _DEBUG_CONTEXT_H
6 #define _DEBUG_CONTEXT_H
7 
8 
9 #include <debug_support.h>
10 
11 
12 class BDebugContext {
13 public:
14 								BDebugContext();
15 								~BDebugContext();
16 
17 			status_t			Init(team_id team, port_id nubPort);
18 			void				Uninit();
19 
20 			team_id				Team() const	{ return fContext.team; }
21 			port_id				NubPort() const	{ return fContext.nub_port; }
22 			port_id				ReplyPort() const
23 									{ return fContext.reply_port; }
24 
25 			status_t			SendDebugMessage(int32 messageCode,
26 									const void *message, size_t messageSize,
27 									void* reply, size_t replySize);
28 
29 			status_t			SetTeamDebuggingFlags(int32 flags);
30 
31 			ssize_t				ReadMemoryPartial(const void* address,
32 									void* buffer, size_t size);
33 			ssize_t				ReadMemory(const void* address,
34 									void* buffer, size_t size);
35 			ssize_t				ReadString(const void* address,
36 									char* buffer, size_t size);
37 
38 			status_t			SetBreakpoint(void* address);
39 			status_t			ClearBreakpoint(void* address);
40 
41 			status_t			SetWatchpoint(void* address, uint32 type,
42 									int32 length);
43 			status_t			ClearWatchpoint(void* address);
44 
45 			status_t			ContinueThread(thread_id thread,
46 									bool singleStep = false);
47 			status_t			SetThreadDebuggingFlags(thread_id thread,
48 									int32 flags);
49 			status_t			GetThreadCpuState(thread_id thread,
50 									debug_debugger_message* _messageCode,
51 									debug_cpu_state* cpuState);
52 
53 protected:
54 			debug_context		fContext;
55 };
56 
57 
58 #endif	// _DEBUG_CONTEXT_H
59