Debugger: Add dedicated functions for global {un}init.
[haiku.git] / src / apps / debugger / debugger_interface / DebugEvent.cpp
blob682de054a7b0f692bd1e6c9c81167d3aac792b9e
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "DebugEvent.h"
8 #include "CpuState.h"
11 // #pragma mark - DebugEvent
14 DebugEvent::DebugEvent(int32 eventType, team_id team,
15 thread_id thread)
17 fEventType(eventType),
18 fTeam(team),
19 fThread(thread),
20 fThreadStopped(false)
25 DebugEvent::~DebugEvent()
30 void
31 DebugEvent::SetThreadStopped(bool stopped)
33 fThreadStopped = stopped;
37 // #pragma mark - CpuStateEvent
40 CpuStateEvent::CpuStateEvent(debug_debugger_message eventType, team_id team,
41 thread_id thread, CpuState* state)
43 DebugEvent(eventType, team, thread),
44 fCpuState(state)
46 if (fCpuState != NULL)
47 fCpuState->AcquireReference();
51 CpuStateEvent::~CpuStateEvent()
53 if (fCpuState != NULL)
54 fCpuState->ReleaseReference();
58 // #pragma mark - ThreadDebuggedEvent
61 ThreadDebuggedEvent::ThreadDebuggedEvent(team_id team, thread_id thread)
63 DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED, team, thread)
68 // #pragma mark - DebuggerCallEvent
71 DebuggerCallEvent::DebuggerCallEvent(team_id team, thread_id thread,
72 target_addr_t message)
74 DebugEvent(B_DEBUGGER_MESSAGE_DEBUGGER_CALL, team, thread),
75 fMessage(message)
80 // #pragma mark - BreakpointHitEvent
83 BreakpointHitEvent::BreakpointHitEvent(team_id team, thread_id thread,
84 CpuState* state)
86 CpuStateEvent(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, team, thread, state)
91 // #pragma mark - WatchpointHitEvent
94 WatchpointHitEvent::WatchpointHitEvent(team_id team, thread_id thread,
95 CpuState* state)
97 CpuStateEvent(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, team, thread, state)
103 // #pragma mark - SingleStepEvent
106 SingleStepEvent::SingleStepEvent(team_id team, thread_id thread,
107 CpuState* state)
109 CpuStateEvent(B_DEBUGGER_MESSAGE_SINGLE_STEP, team, thread, state)
114 // #pragma mark - ExceptionOccurredEvent
117 ExceptionOccurredEvent::ExceptionOccurredEvent(team_id team, thread_id thread,
118 debug_exception_type exception)
120 DebugEvent(B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, team, thread),
121 fException(exception)
126 // #pragma mark - TeamDeletedEvent
129 TeamDeletedEvent::TeamDeletedEvent(team_id team, thread_id thread)
131 DebugEvent(B_DEBUGGER_MESSAGE_TEAM_DELETED, team, thread)
136 // #pragma mark - TeamExecEvent
139 TeamExecEvent::TeamExecEvent(team_id team, thread_id thread)
141 DebugEvent(B_DEBUGGER_MESSAGE_TEAM_EXEC, team, thread)
146 // #pragma mark - ThreadCreatedEvent
149 ThreadCreatedEvent::ThreadCreatedEvent(team_id team, thread_id thread,
150 thread_id newThread)
152 DebugEvent(B_DEBUGGER_MESSAGE_THREAD_CREATED, team, thread),
153 fNewThread(newThread)
158 // #pragma mark - ThreadRenamedEvent
161 ThreadRenamedEvent::ThreadRenamedEvent(team_id team, thread_id thread,
162 thread_id renamedThread, const char* newName)
164 DebugEvent(DEBUGGER_MESSAGE_THREAD_RENAMED, team, thread),
165 fRenamedThread(renamedThread)
167 strlcpy(fName, newName, sizeof(fName));
171 // #pragma mark - ThreadPriorityChangedEvent
174 ThreadPriorityChangedEvent::ThreadPriorityChangedEvent(team_id team,
175 thread_id thread, thread_id changedThread, int32 newPriority)
177 DebugEvent(DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED, team, thread),
178 fChangedThread(changedThread),
179 fNewPriority(newPriority)
184 // #pragma mark - ThreadDeletedEvent
187 ThreadDeletedEvent::ThreadDeletedEvent(team_id team, thread_id thread)
189 DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DELETED, team, thread)
194 // #pragma mark - ImageCreatedEvent
197 ImageCreatedEvent::ImageCreatedEvent(team_id team, thread_id thread,
198 const ImageInfo& info)
200 DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_CREATED, team, thread),
201 fInfo(info)
206 // #pragma mark - ImageDeletedEvent
209 ImageDeletedEvent::ImageDeletedEvent(team_id team, thread_id thread,
210 const ImageInfo& info)
212 DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_DELETED, team, thread),
213 fInfo(info)
218 // #pragma mark - PostSyscallEvent
221 PostSyscallEvent::PostSyscallEvent(team_id team, thread_id thread,
222 const SyscallInfo& info)
224 DebugEvent(B_DEBUGGER_MESSAGE_POST_SYSCALL, team, thread),
225 fInfo(info)
230 // #pragma mark - HandedOverEvent
233 HandedOverEvent::HandedOverEvent(team_id team, thread_id thread,
234 thread_id causingThread)
236 DebugEvent(B_DEBUGGER_MESSAGE_HANDED_OVER, team, thread),
237 fCausingThread(causingThread)
242 // #pragma mark - SignalReceivedEvent
245 SignalReceivedEvent::SignalReceivedEvent(team_id team, thread_id thread,
246 const SignalInfo& info)
248 DebugEvent(B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED, team, thread),
249 fInfo(info)