xref: /haiku/src/kits/debugger/debugger_interface/DebugEvent.h (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1*fce4895dSRene Gollent /*
2*fce4895dSRene Gollent  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3*fce4895dSRene Gollent  * Copyright 2013, Rene Gollent, rene@gollent.com.
4*fce4895dSRene Gollent  * Distributed under the terms of the MIT License.
5*fce4895dSRene Gollent  */
6*fce4895dSRene Gollent #ifndef DEBUG_EVENT_H
7*fce4895dSRene Gollent #define DEBUG_EVENT_H
8*fce4895dSRene Gollent 
9*fce4895dSRene Gollent #include <debugger.h>
10*fce4895dSRene Gollent 
11*fce4895dSRene Gollent #include "ImageInfo.h"
12*fce4895dSRene Gollent #include "SignalInfo.h"
13*fce4895dSRene Gollent #include "SyscallInfo.h"
14*fce4895dSRene Gollent #include "Types.h"
15*fce4895dSRene Gollent 
16*fce4895dSRene Gollent 
17*fce4895dSRene Gollent class CpuState;
18*fce4895dSRene Gollent 
19*fce4895dSRene Gollent 
20*fce4895dSRene Gollent // constants for synthetic events generated via the
21*fce4895dSRene Gollent // start_system_watching() interface
22*fce4895dSRene Gollent enum {
23*fce4895dSRene Gollent 	DEBUGGER_MESSAGE_THREAD_RENAMED				= 'dmtr',
24*fce4895dSRene Gollent 	DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED	= 'dmpc'
25*fce4895dSRene Gollent };
26*fce4895dSRene Gollent 
27*fce4895dSRene Gollent 
28*fce4895dSRene Gollent class DebugEvent {
29*fce4895dSRene Gollent public:
30*fce4895dSRene Gollent 								DebugEvent(int32 eventType,
31*fce4895dSRene Gollent 									team_id team, thread_id thread);
32*fce4895dSRene Gollent 	virtual						~DebugEvent();
33*fce4895dSRene Gollent 
EventType()34*fce4895dSRene Gollent 			int32 				EventType() const		{ return fEventType; }
Team()35*fce4895dSRene Gollent 			team_id				Team() const			{ return fTeam; }
Thread()36*fce4895dSRene Gollent 			thread_id			Thread() const			{ return fThread; }
37*fce4895dSRene Gollent 
ThreadStopped()38*fce4895dSRene Gollent 			bool				ThreadStopped() const { return fThreadStopped; }
39*fce4895dSRene Gollent 			void				SetThreadStopped(bool stopped);
40*fce4895dSRene Gollent 
41*fce4895dSRene Gollent private:
42*fce4895dSRene Gollent 			int32 				fEventType;
43*fce4895dSRene Gollent 			team_id				fTeam;
44*fce4895dSRene Gollent 			thread_id			fThread;
45*fce4895dSRene Gollent 			bool				fThreadStopped;
46*fce4895dSRene Gollent };
47*fce4895dSRene Gollent 
48*fce4895dSRene Gollent 
49*fce4895dSRene Gollent class CpuStateEvent : public DebugEvent {
50*fce4895dSRene Gollent public:
51*fce4895dSRene Gollent 								CpuStateEvent(debug_debugger_message eventType,
52*fce4895dSRene Gollent 									team_id team, thread_id thread,
53*fce4895dSRene Gollent 									CpuState* state);
54*fce4895dSRene Gollent 	virtual						~CpuStateEvent();
55*fce4895dSRene Gollent 
GetCpuState()56*fce4895dSRene Gollent 			CpuState*			GetCpuState() const	{ return fCpuState; }
57*fce4895dSRene Gollent 
58*fce4895dSRene Gollent private:
59*fce4895dSRene Gollent 			CpuState*			fCpuState;
60*fce4895dSRene Gollent };
61*fce4895dSRene Gollent 
62*fce4895dSRene Gollent 
63*fce4895dSRene Gollent class ThreadDebuggedEvent : public DebugEvent {
64*fce4895dSRene Gollent public:
65*fce4895dSRene Gollent 								ThreadDebuggedEvent(team_id team,
66*fce4895dSRene Gollent 									thread_id thread);
67*fce4895dSRene Gollent };
68*fce4895dSRene Gollent 
69*fce4895dSRene Gollent 
70*fce4895dSRene Gollent class DebuggerCallEvent : public DebugEvent {
71*fce4895dSRene Gollent public:
72*fce4895dSRene Gollent 								DebuggerCallEvent(team_id team,
73*fce4895dSRene Gollent 									thread_id thread, target_addr_t message);
74*fce4895dSRene Gollent 
Message()75*fce4895dSRene Gollent 			target_addr_t		Message() const	{ return fMessage; }
76*fce4895dSRene Gollent 
77*fce4895dSRene Gollent private:
78*fce4895dSRene Gollent 			target_addr_t		fMessage;
79*fce4895dSRene Gollent };
80*fce4895dSRene Gollent 
81*fce4895dSRene Gollent 
82*fce4895dSRene Gollent class BreakpointHitEvent : public CpuStateEvent {
83*fce4895dSRene Gollent public:
84*fce4895dSRene Gollent 								BreakpointHitEvent(team_id team,
85*fce4895dSRene Gollent 									thread_id thread, CpuState* state);
86*fce4895dSRene Gollent };
87*fce4895dSRene Gollent 
88*fce4895dSRene Gollent 
89*fce4895dSRene Gollent class WatchpointHitEvent : public CpuStateEvent {
90*fce4895dSRene Gollent public:
91*fce4895dSRene Gollent 								WatchpointHitEvent(team_id team,
92*fce4895dSRene Gollent 									thread_id thread, CpuState* state);
93*fce4895dSRene Gollent };
94*fce4895dSRene Gollent 
95*fce4895dSRene Gollent 
96*fce4895dSRene Gollent class SingleStepEvent : public CpuStateEvent {
97*fce4895dSRene Gollent public:
98*fce4895dSRene Gollent 								SingleStepEvent(team_id team,
99*fce4895dSRene Gollent 									thread_id thread, CpuState* state);
100*fce4895dSRene Gollent };
101*fce4895dSRene Gollent 
102*fce4895dSRene Gollent 
103*fce4895dSRene Gollent class ExceptionOccurredEvent : public DebugEvent {
104*fce4895dSRene Gollent public:
105*fce4895dSRene Gollent 								ExceptionOccurredEvent(team_id team,
106*fce4895dSRene Gollent 									thread_id thread,
107*fce4895dSRene Gollent 									debug_exception_type exception);
108*fce4895dSRene Gollent 
Exception()109*fce4895dSRene Gollent 			debug_exception_type Exception() const	{ return fException; }
110*fce4895dSRene Gollent 
111*fce4895dSRene Gollent private:
112*fce4895dSRene Gollent 			debug_exception_type fException;
113*fce4895dSRene Gollent };
114*fce4895dSRene Gollent 
115*fce4895dSRene Gollent 
116*fce4895dSRene Gollent class TeamDeletedEvent : public DebugEvent {
117*fce4895dSRene Gollent public:
118*fce4895dSRene Gollent 								TeamDeletedEvent(team_id team,
119*fce4895dSRene Gollent 									thread_id thread);
120*fce4895dSRene Gollent };
121*fce4895dSRene Gollent 
122*fce4895dSRene Gollent 
123*fce4895dSRene Gollent class TeamExecEvent : public DebugEvent {
124*fce4895dSRene Gollent public:
125*fce4895dSRene Gollent 								TeamExecEvent(team_id team, thread_id thread);
126*fce4895dSRene Gollent };
127*fce4895dSRene Gollent 
128*fce4895dSRene Gollent 
129*fce4895dSRene Gollent class ThreadCreatedEvent : public DebugEvent {
130*fce4895dSRene Gollent public:
131*fce4895dSRene Gollent 								ThreadCreatedEvent(team_id team,
132*fce4895dSRene Gollent 									thread_id thread, thread_id newThread);
133*fce4895dSRene Gollent 
NewThread()134*fce4895dSRene Gollent 			thread_id			NewThread() const	{ return fNewThread; }
135*fce4895dSRene Gollent 
136*fce4895dSRene Gollent private:
137*fce4895dSRene Gollent 			thread_id			fNewThread;
138*fce4895dSRene Gollent };
139*fce4895dSRene Gollent 
140*fce4895dSRene Gollent 
141*fce4895dSRene Gollent class ThreadRenamedEvent : public DebugEvent {
142*fce4895dSRene Gollent public:
143*fce4895dSRene Gollent 								ThreadRenamedEvent(team_id team,
144*fce4895dSRene Gollent 									thread_id thread, thread_id renamedThread,
145*fce4895dSRene Gollent 									const char* name);
146*fce4895dSRene Gollent 
RenamedThread()147*fce4895dSRene Gollent 			thread_id			RenamedThread() const { return fRenamedThread; }
NewName()148*fce4895dSRene Gollent 			const char*			NewName() const	{ return fName; }
149*fce4895dSRene Gollent 
150*fce4895dSRene Gollent private:
151*fce4895dSRene Gollent 			thread_id			fRenamedThread;
152*fce4895dSRene Gollent 			char				fName[B_OS_NAME_LENGTH];
153*fce4895dSRene Gollent };
154*fce4895dSRene Gollent 
155*fce4895dSRene Gollent 
156*fce4895dSRene Gollent class ThreadPriorityChangedEvent : public DebugEvent {
157*fce4895dSRene Gollent public:
158*fce4895dSRene Gollent 								ThreadPriorityChangedEvent(team_id team,
159*fce4895dSRene Gollent 									thread_id thread, thread_id changedThread,
160*fce4895dSRene Gollent 									int32 newPriority);
161*fce4895dSRene Gollent 
ChangedThread()162*fce4895dSRene Gollent 			thread_id			ChangedThread() const { return fChangedThread; }
NewPriority()163*fce4895dSRene Gollent 			int32				NewPriority() const	{ return fNewPriority; }
164*fce4895dSRene Gollent 
165*fce4895dSRene Gollent private:
166*fce4895dSRene Gollent 			thread_id			fChangedThread;
167*fce4895dSRene Gollent 			int32				fNewPriority;
168*fce4895dSRene Gollent };
169*fce4895dSRene Gollent 
170*fce4895dSRene Gollent 
171*fce4895dSRene Gollent class ThreadDeletedEvent : public DebugEvent {
172*fce4895dSRene Gollent public:
173*fce4895dSRene Gollent 								ThreadDeletedEvent(team_id team,
174*fce4895dSRene Gollent 									thread_id thread);
175*fce4895dSRene Gollent };
176*fce4895dSRene Gollent 
177*fce4895dSRene Gollent 
178*fce4895dSRene Gollent class ImageCreatedEvent : public DebugEvent {
179*fce4895dSRene Gollent public:
180*fce4895dSRene Gollent 								ImageCreatedEvent(team_id team,
181*fce4895dSRene Gollent 									thread_id thread, const ImageInfo& info);
182*fce4895dSRene Gollent 
GetImageInfo()183*fce4895dSRene Gollent 			const ImageInfo&	GetImageInfo() const	{ return fInfo; }
184*fce4895dSRene Gollent 
185*fce4895dSRene Gollent private:
186*fce4895dSRene Gollent 			ImageInfo			fInfo;
187*fce4895dSRene Gollent };
188*fce4895dSRene Gollent 
189*fce4895dSRene Gollent 
190*fce4895dSRene Gollent class ImageDeletedEvent : public DebugEvent {
191*fce4895dSRene Gollent public:
192*fce4895dSRene Gollent 								ImageDeletedEvent(team_id team,
193*fce4895dSRene Gollent 									thread_id thread, const ImageInfo& info);
194*fce4895dSRene Gollent 
GetImageInfo()195*fce4895dSRene Gollent 			const ImageInfo&	GetImageInfo() const	{ return fInfo; }
196*fce4895dSRene Gollent 
197*fce4895dSRene Gollent private:
198*fce4895dSRene Gollent 			ImageInfo			fInfo;
199*fce4895dSRene Gollent };
200*fce4895dSRene Gollent 
201*fce4895dSRene Gollent 
202*fce4895dSRene Gollent class PostSyscallEvent : public DebugEvent {
203*fce4895dSRene Gollent public:
204*fce4895dSRene Gollent 								PostSyscallEvent(team_id team,
205*fce4895dSRene Gollent 									thread_id thread,
206*fce4895dSRene Gollent 									const SyscallInfo& info);
207*fce4895dSRene Gollent 
GetSyscallInfo()208*fce4895dSRene Gollent 			const SyscallInfo&	GetSyscallInfo() const	{ return fInfo; }
209*fce4895dSRene Gollent 
210*fce4895dSRene Gollent private:
211*fce4895dSRene Gollent 			SyscallInfo			fInfo;
212*fce4895dSRene Gollent };
213*fce4895dSRene Gollent 
214*fce4895dSRene Gollent 
215*fce4895dSRene Gollent class HandedOverEvent : public DebugEvent {
216*fce4895dSRene Gollent public:
217*fce4895dSRene Gollent 								HandedOverEvent(team_id team,
218*fce4895dSRene Gollent 									thread_id thread, thread_id causingThread);
219*fce4895dSRene Gollent 
CausingThread()220*fce4895dSRene Gollent 			thread_id			CausingThread() const { return fCausingThread; }
221*fce4895dSRene Gollent 
222*fce4895dSRene Gollent private:
223*fce4895dSRene Gollent 			thread_id			fCausingThread;
224*fce4895dSRene Gollent };
225*fce4895dSRene Gollent 
226*fce4895dSRene Gollent 
227*fce4895dSRene Gollent class SignalReceivedEvent : public DebugEvent {
228*fce4895dSRene Gollent public:
229*fce4895dSRene Gollent 								SignalReceivedEvent(team_id team,
230*fce4895dSRene Gollent 									thread_id thread,
231*fce4895dSRene Gollent 									const SignalInfo& info);
232*fce4895dSRene Gollent 
GetSignalInfo()233*fce4895dSRene Gollent 			const SignalInfo&	GetSignalInfo() const	{ return fInfo; }
234*fce4895dSRene Gollent 
235*fce4895dSRene Gollent private:
236*fce4895dSRene Gollent 			SignalInfo			fInfo;
237*fce4895dSRene Gollent };
238*fce4895dSRene Gollent 
239*fce4895dSRene Gollent 
240*fce4895dSRene Gollent #endif	// DEBUG_EVENT_H
241