* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "DebugEvent.h"
#include "CpuState.h"
DebugEvent::DebugEvent(int32 eventType, team_id team,
thread_id thread)
:
fEventType(eventType),
fTeam(team),
fThread(thread),
fThreadStopped(false)
{
}
DebugEvent::~DebugEvent()
{
}
void
DebugEvent::SetThreadStopped(bool stopped)
{
fThreadStopped = stopped;
}
CpuStateEvent::CpuStateEvent(debug_debugger_message eventType, team_id team,
thread_id thread, CpuState* state)
:
DebugEvent(eventType, team, thread),
fCpuState(state)
{
if (fCpuState != NULL)
fCpuState->AcquireReference();
}
CpuStateEvent::~CpuStateEvent()
{
if (fCpuState != NULL)
fCpuState->ReleaseReference();
}
ThreadDebuggedEvent::ThreadDebuggedEvent(team_id team, thread_id thread)
:
DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED, team, thread)
{
}
DebuggerCallEvent::DebuggerCallEvent(team_id team, thread_id thread,
target_addr_t message)
:
DebugEvent(B_DEBUGGER_MESSAGE_DEBUGGER_CALL, team, thread),
fMessage(message)
{
}
BreakpointHitEvent::BreakpointHitEvent(team_id team, thread_id thread,
CpuState* state)
:
CpuStateEvent(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, team, thread, state)
{
}
WatchpointHitEvent::WatchpointHitEvent(team_id team, thread_id thread,
CpuState* state)
:
CpuStateEvent(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, team, thread, state)
{
}
SingleStepEvent::SingleStepEvent(team_id team, thread_id thread,
CpuState* state)
:
CpuStateEvent(B_DEBUGGER_MESSAGE_SINGLE_STEP, team, thread, state)
{
}
ExceptionOccurredEvent::ExceptionOccurredEvent(team_id team, thread_id thread,
debug_exception_type exception)
:
DebugEvent(B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, team, thread),
fException(exception)
{
}
TeamDeletedEvent::TeamDeletedEvent(team_id team, thread_id thread)
:
DebugEvent(B_DEBUGGER_MESSAGE_TEAM_DELETED, team, thread)
{
}
TeamExecEvent::TeamExecEvent(team_id team, thread_id thread)
:
DebugEvent(B_DEBUGGER_MESSAGE_TEAM_EXEC, team, thread)
{
}
ThreadCreatedEvent::ThreadCreatedEvent(team_id team, thread_id thread,
thread_id newThread)
:
DebugEvent(B_DEBUGGER_MESSAGE_THREAD_CREATED, team, thread),
fNewThread(newThread)
{
}
ThreadRenamedEvent::ThreadRenamedEvent(team_id team, thread_id thread,
thread_id renamedThread, const char* newName)
:
DebugEvent(DEBUGGER_MESSAGE_THREAD_RENAMED, team, thread),
fRenamedThread(renamedThread)
{
strlcpy(fName, newName, sizeof(fName));
}
ThreadPriorityChangedEvent::ThreadPriorityChangedEvent(team_id team,
thread_id thread, thread_id changedThread, int32 newPriority)
:
DebugEvent(DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED, team, thread),
fChangedThread(changedThread),
fNewPriority(newPriority)
{
}
ThreadDeletedEvent::ThreadDeletedEvent(team_id team, thread_id thread)
:
DebugEvent(B_DEBUGGER_MESSAGE_THREAD_DELETED, team, thread)
{
}
ImageCreatedEvent::ImageCreatedEvent(team_id team, thread_id thread,
const ImageInfo& info)
:
DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_CREATED, team, thread),
fInfo(info)
{
}
ImageDeletedEvent::ImageDeletedEvent(team_id team, thread_id thread,
const ImageInfo& info)
:
DebugEvent(B_DEBUGGER_MESSAGE_IMAGE_DELETED, team, thread),
fInfo(info)
{
}
PostSyscallEvent::PostSyscallEvent(team_id team, thread_id thread,
const SyscallInfo& info)
:
DebugEvent(B_DEBUGGER_MESSAGE_POST_SYSCALL, team, thread),
fInfo(info)
{
}
HandedOverEvent::HandedOverEvent(team_id team, thread_id thread,
thread_id causingThread)
:
DebugEvent(B_DEBUGGER_MESSAGE_HANDED_OVER, team, thread),
fCausingThread(causingThread)
{
}
SignalReceivedEvent::SignalReceivedEvent(team_id team, thread_id thread,
const SignalInfo& info)
:
DebugEvent(B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED, team, thread),
fInfo(info)
{
}