1f208695cSIngo Weinhold/*
2f208695cSIngo Weinhold * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3f208695cSIngo Weinhold * Distributed under the terms of the MIT License.
4f208695cSIngo Weinhold */
5f208695cSIngo Weinhold
6f208695cSIngo Weinhold#include "DebugEvent.h"
7f208695cSIngo Weinhold
8f208695cSIngo Weinhold#include "CpuState.h"
9f208695cSIngo Weinhold
10f208695cSIngo Weinhold
11f208695cSIngo Weinhold// #pragma mark - DebugEvent
12f208695cSIngo Weinhold
13f208695cSIngo Weinhold
14ba3f23c6SRene GollentDebugEvent::DebugEvent(int32 eventType, team_id team,
15f208695cSIngo Weinhold	thread_id thread)
16f208695cSIngo Weinhold	:
17f208695cSIngo Weinhold	fEventType(eventType),
18f208695cSIngo Weinhold	fTeam(team),
19f208695cSIngo Weinhold	fThread(thread),
20f208695cSIngo Weinhold	fThreadStopped(false)
21f208695cSIngo Weinhold{
22f208695cSIngo Weinhold}
23f208695cSIngo Weinhold
24f208695cSIngo Weinhold
25f208695cSIngo WeinholdDebugEvent::~DebugEvent()
26f208695cSIngo Weinhold{
27f208695cSIngo Weinhold}
28f208695cSIngo Weinhold
29f208695cSIngo Weinhold
30f208695cSIngo Weinholdvoid
31f208695cSIngo WeinholdDebugEvent::SetThreadStopped(bool stopped)
32f208695cSIngo Weinhold{
33f208695cSIngo Weinhold	fThreadStopped = stopped;
34f208695cSIngo Weinhold}
35f208695cSIngo Weinhold
36f208695cSIngo Weinhold
37f208695cSIngo Weinhold// #pragma mark - CpuStateEvent
38f208695cSIngo Weinhold
39f208695cSIngo Weinhold
40f208695cSIngo WeinholdCpuStateEvent::CpuStateEvent(debug_debugger_message eventType, team_id team,
41f208695cSIngo Weinhold	thread_id thread, CpuState* state)
42f208695cSIngo Weinhold	:
43f208695cSIngo Weinhold	DebugEvent(eventType, team, thread),
44f208695cSIngo Weinhold	fCpuState(state)
45f208695cSIngo Weinhold{
46f208695cSIngo Weinhold	if (fCpuState != NULL)
47c3e066cfSIngo Weinhold		fCpuState->AcquireReference();
48f208695cSIngo Weinhold}
49f208695cSIngo Weinhold
50f208695cSIngo Weinhold
51f208695cSIngo WeinholdCpuStateEvent::~CpuStateEvent()
52f208695cSIngo Weinhold{
53f208695cSIngo Weinhold	if (fCpuState != NULL)
54c3e066cfSIngo Weinhold		fCpuState->ReleaseReference();
55f208695cSIngo Weinhold}
56f208695cSIngo Weinhold
57f208695cSIngo Weinhold
58f208695cSIngo Weinhold// #pragma mark - ThreadDebuggedEvent
59f208695cSIngo Weinhold
60f208695cSIngo Weinhold
61f208695cSIngo WeinholdThreadDebuggedEvent::ThreadDebuggedEvent(team_id team, thread_id thread)
62f208695cSIngo Weinhold	:
63f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED, team, thread)
64f208695cSIngo Weinhold{
65f208695cSIngo Weinhold}
66f208695cSIngo Weinhold
67f208695cSIngo Weinhold
68f208695cSIngo Weinhold// #pragma mark - DebuggerCallEvent
69f208695cSIngo Weinhold
70f208695cSIngo Weinhold
71f208695cSIngo WeinholdDebuggerCallEvent::DebuggerCallEvent(team_id team, thread_id thread,
72f208695cSIngo Weinhold	target_addr_t message)
73f208695cSIngo Weinhold	:
74f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_DEBUGGER_CALL, team, thread),
75f208695cSIngo Weinhold	fMessage(message)
76f208695cSIngo Weinhold{
77f208695cSIngo Weinhold}
78f208695cSIngo Weinhold
79f208695cSIngo Weinhold
80f208695cSIngo Weinhold// #pragma mark - BreakpointHitEvent
81f208695cSIngo Weinhold
82f208695cSIngo Weinhold
83f208695cSIngo WeinholdBreakpointHitEvent::BreakpointHitEvent(team_id team, thread_id thread,
84f208695cSIngo Weinhold	CpuState* state)
85f208695cSIngo Weinhold	:
86f208695cSIngo Weinhold	CpuStateEvent(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, team, thread, state)
87f208695cSIngo Weinhold{
88f208695cSIngo Weinhold}
89f208695cSIngo Weinhold
90f208695cSIngo Weinhold
91f208695cSIngo Weinhold// #pragma mark - WatchpointHitEvent
92f208695cSIngo Weinhold
93f208695cSIngo Weinhold
94f208695cSIngo WeinholdWatchpointHitEvent::WatchpointHitEvent(team_id team, thread_id thread,
95f208695cSIngo Weinhold	CpuState* state)
96f208695cSIngo Weinhold	:
97f208695cSIngo Weinhold	CpuStateEvent(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, team, thread, state)
98f208695cSIngo Weinhold{
99f208695cSIngo Weinhold}
100f208695cSIngo Weinhold
101f208695cSIngo Weinhold
102f208695cSIngo Weinhold
103f208695cSIngo Weinhold// #pragma mark - SingleStepEvent
104f208695cSIngo Weinhold
105f208695cSIngo Weinhold
106f208695cSIngo WeinholdSingleStepEvent::SingleStepEvent(team_id team, thread_id thread,
107f208695cSIngo Weinhold	CpuState* state)
108f208695cSIngo Weinhold	:
109f208695cSIngo Weinhold	CpuStateEvent(B_DEBUGGER_MESSAGE_SINGLE_STEP, team, thread, state)
110f208695cSIngo Weinhold{
111f208695cSIngo Weinhold}
112f208695cSIngo Weinhold
113f208695cSIngo Weinhold
114f208695cSIngo Weinhold// #pragma mark - ExceptionOccurredEvent
115f208695cSIngo Weinhold
116f208695cSIngo Weinhold
117f208695cSIngo WeinholdExceptionOccurredEvent::ExceptionOccurredEvent(team_id team, thread_id thread,
118c6952b68SIngo Weinhold	debug_exception_type exception)
119f208695cSIngo Weinhold	:
120f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, team, thread),
121f208695cSIngo Weinhold	fException(exception)
122f208695cSIngo Weinhold{
123f208695cSIngo Weinhold}
124f208695cSIngo Weinhold
125f208695cSIngo Weinhold
126f208695cSIngo Weinhold// #pragma mark - TeamDeletedEvent
127f208695cSIngo Weinhold
128f208695cSIngo Weinhold
129f208695cSIngo WeinholdTeamDeletedEvent::TeamDeletedEvent(team_id team, thread_id thread)
130f208695cSIngo Weinhold	:
131f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_TEAM_DELETED, team, thread)
132f208695cSIngo Weinhold{
133f208695cSIngo Weinhold}
134f208695cSIngo Weinhold
135f208695cSIngo Weinhold
136f208695cSIngo Weinhold// #pragma mark - TeamExecEvent
137f208695cSIngo Weinhold
138f208695cSIngo Weinhold
139f208695cSIngo WeinholdTeamExecEvent::TeamExecEvent(team_id team, thread_id thread)
140f208695cSIngo Weinhold	:
141f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_TEAM_EXEC, team, thread)
142f208695cSIngo Weinhold{
143f208695cSIngo Weinhold}
144f208695cSIngo Weinhold
145f208695cSIngo Weinhold
146f208695cSIngo Weinhold// #pragma mark - ThreadCreatedEvent
147f208695cSIngo Weinhold
148f208695cSIngo Weinhold
149f208695cSIngo WeinholdThreadCreatedEvent::ThreadCreatedEvent(team_id team, thread_id thread,
150f208695cSIngo Weinhold	thread_id newThread)
151f208695cSIngo Weinhold	:
152f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_THREAD_CREATED, team, thread),
153f208695cSIngo Weinhold	fNewThread(newThread)
154f208695cSIngo Weinhold{
155f208695cSIngo Weinhold}
156f208695cSIngo Weinhold
157f208695cSIngo Weinhold
158ba3f23c6SRene Gollent// #pragma mark - ThreadRenamedEvent
159ba3f23c6SRene Gollent
160ba3f23c6SRene Gollent
161ba3f23c6SRene GollentThreadRenamedEvent::ThreadRenamedEvent(team_id team, thread_id thread,
162ba3f23c6SRene Gollent	thread_id renamedThread, const char* newName)
163ba3f23c6SRene Gollent	:
164ba3f23c6SRene Gollent	DebugEvent(DEBUGGER_MESSAGE_THREAD_RENAMED, team, thread),
165ba3f23c6SRene Gollent	fRenamedThread(renamedThread)
166ba3f23c6SRene Gollent{
167ba3f23c6SRene Gollent	strlcpy(fName, newName, sizeof(fName));
168ba3f23c6SRene Gollent}
169ba3f23c6SRene Gollent
170ba3f23c6SRene Gollent
171ba3f23c6SRene Gollent// #pragma mark - ThreadPriorityChangedEvent
172ba3f23c6SRene Gollent
173ba3f23c6SRene Gollent
174ba3f23c6SRene GollentThreadPriorityChangedEvent::ThreadPriorityChangedEvent(team_id team,
175ba3f23c6SRene Gollent	thread_id thread, thread_id changedThread, int32 newPriority)
176ba3f23c6SRene Gollent	:
177ba3f23c6SRene Gollent	DebugEvent(DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED, team, thread),
178ba3f23c6SRene Gollent	fChangedThread(changedThread),
179ba3f23c6SRene Gollent	fNewPriority(newPriority)
180ba3f23c6SRene Gollent{
181ba3f23c6SRene Gollent}
182ba3f23c6SRene Gollent
183ba3f23c6SRene Gollent
184f208695cSIngo Weinhold// #pragma mark - ThreadDeletedEvent
185f208695cSIngo Weinhold
186f208695cSIngo Weinhold
187f208695cSIngo WeinholdThreadDeletedEvent::ThreadDeletedEvent(team_id team, thread_id thread)
188f208695cSIngo Weinhold	:
189f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DELETED, team, thread)
190f208695cSIngo Weinhold{
191f208695cSIngo Weinhold}
192f208695cSIngo Weinhold
193f208695cSIngo Weinhold
194f208695cSIngo Weinhold// #pragma mark - ImageCreatedEvent
195f208695cSIngo Weinhold
196f208695cSIngo Weinhold
197f208695cSIngo WeinholdImageCreatedEvent::ImageCreatedEvent(team_id team, thread_id thread,
198f208695cSIngo Weinhold	const ImageInfo& info)
199f208695cSIngo Weinhold	:
200f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_CREATED, team, thread),
201f208695cSIngo Weinhold	fInfo(info)
202f208695cSIngo Weinhold{
203f208695cSIngo Weinhold}
204f208695cSIngo Weinhold
205f208695cSIngo Weinhold
206f208695cSIngo Weinhold// #pragma mark - ImageDeletedEvent
207f208695cSIngo Weinhold
208f208695cSIngo Weinhold
209f208695cSIngo WeinholdImageDeletedEvent::ImageDeletedEvent(team_id team, thread_id thread,
210f208695cSIngo Weinhold	const ImageInfo& info)
211f208695cSIngo Weinhold	:
212f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_DELETED, team, thread),
213f208695cSIngo Weinhold	fInfo(info)
214f208695cSIngo Weinhold{
215f208695cSIngo Weinhold}
216f208695cSIngo Weinhold
217f208695cSIngo Weinhold
21823f48a24SRene Gollent// #pragma mark - PostSyscallEvent
21923f48a24SRene Gollent
22023f48a24SRene Gollent
22123f48a24SRene GollentPostSyscallEvent::PostSyscallEvent(team_id team, thread_id thread,
22223f48a24SRene Gollent	const SyscallInfo& info)
22323f48a24SRene Gollent	:
22423f48a24SRene Gollent	DebugEvent(B_DEBUGGER_MESSAGE_POST_SYSCALL, team, thread),
22523f48a24SRene Gollent	fInfo(info)
22623f48a24SRene Gollent{
22723f48a24SRene Gollent}
22823f48a24SRene Gollent
22923f48a24SRene Gollent
230f208695cSIngo Weinhold// #pragma mark - HandedOverEvent
231f208695cSIngo Weinhold
232f208695cSIngo Weinhold
233f208695cSIngo WeinholdHandedOverEvent::HandedOverEvent(team_id team, thread_id thread,
234f208695cSIngo Weinhold	thread_id causingThread)
235f208695cSIngo Weinhold	:
236f208695cSIngo Weinhold	DebugEvent(B_DEBUGGER_MESSAGE_HANDED_OVER, team, thread),
237f208695cSIngo Weinhold	fCausingThread(causingThread)
238f208695cSIngo Weinhold{
239f208695cSIngo Weinhold}
240601a9f1dSRene Gollent
241601a9f1dSRene Gollent
242601a9f1dSRene Gollent// #pragma mark - SignalReceivedEvent
243601a9f1dSRene Gollent
244601a9f1dSRene Gollent
245601a9f1dSRene GollentSignalReceivedEvent::SignalReceivedEvent(team_id team, thread_id thread,
246601a9f1dSRene Gollent	const SignalInfo& info)
247601a9f1dSRene Gollent	:
248601a9f1dSRene Gollent	DebugEvent(B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED, team, thread),
249601a9f1dSRene Gollent	fInfo(info)
250601a9f1dSRene Gollent{
251601a9f1dSRene Gollent}
252