2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
7 #include <DebugMessageHandler.h>
10 BDebugMessageHandler::~BDebugMessageHandler()
15 /*! Handles the supplied debugger message.
16 Can be overridded by subclasses. The base class implementation calls the
17 respective Handle*() hook for the message.
19 \param messageCode The (port) message code identifying the debugger message.
20 \param message The message data.
21 \return \c true, if the caller is supposed to continue the thread, \c false
25 BDebugMessageHandler::HandleDebugMessage(int32 messageCode
,
26 const debug_debugger_message_data
& message
)
28 switch (messageCode
) {
29 case B_DEBUGGER_MESSAGE_THREAD_DEBUGGED
:
30 return HandleThreadDebugged(message
.thread_debugged
);
31 case B_DEBUGGER_MESSAGE_DEBUGGER_CALL
:
32 return HandleDebuggerCall(message
.debugger_call
);
33 case B_DEBUGGER_MESSAGE_BREAKPOINT_HIT
:
34 return HandleBreakpointHit(message
.breakpoint_hit
);
35 case B_DEBUGGER_MESSAGE_WATCHPOINT_HIT
:
36 return HandleWatchpointHit(message
.watchpoint_hit
);
37 case B_DEBUGGER_MESSAGE_SINGLE_STEP
:
38 return HandleSingleStep(message
.single_step
);
39 case B_DEBUGGER_MESSAGE_PRE_SYSCALL
:
40 return HandlePreSyscall(message
.pre_syscall
);
41 case B_DEBUGGER_MESSAGE_POST_SYSCALL
:
42 return HandlePostSyscall(message
.post_syscall
);
43 case B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED
:
44 return HandleSignalReceived(message
.signal_received
);
45 case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED
:
46 return HandleExceptionOccurred(message
.exception_occurred
);
47 case B_DEBUGGER_MESSAGE_TEAM_CREATED
:
48 return HandleTeamCreated(message
.team_created
);
49 case B_DEBUGGER_MESSAGE_TEAM_DELETED
:
50 return HandleTeamDeleted(message
.team_deleted
);
51 case B_DEBUGGER_MESSAGE_TEAM_EXEC
:
52 return HandleTeamExec(message
.team_exec
);
53 case B_DEBUGGER_MESSAGE_THREAD_CREATED
:
54 return HandleThreadCreated(message
.thread_created
);
55 case B_DEBUGGER_MESSAGE_THREAD_DELETED
:
56 return HandleThreadDeleted(message
.thread_deleted
);
57 case B_DEBUGGER_MESSAGE_IMAGE_CREATED
:
58 return HandleImageCreated(message
.image_created
);
59 case B_DEBUGGER_MESSAGE_IMAGE_DELETED
:
60 return HandleImageDeleted(message
.image_deleted
);
61 case B_DEBUGGER_MESSAGE_PROFILER_UPDATE
:
62 return HandleProfilerUpdate(message
.profiler_update
);
63 case B_DEBUGGER_MESSAGE_HANDED_OVER
:
64 return HandleHandedOver(message
.handed_over
);
72 BDebugMessageHandler::HandleThreadDebugged(const debug_thread_debugged
& message
)
74 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED
,
75 (const debug_debugger_message_data
&)message
);
80 BDebugMessageHandler::HandleDebuggerCall(const debug_debugger_call
& message
)
82 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_DEBUGGER_CALL
,
83 (const debug_debugger_message_data
&)message
);
88 BDebugMessageHandler::HandleBreakpointHit(const debug_breakpoint_hit
& message
)
90 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT
,
91 (const debug_debugger_message_data
&)message
);
96 BDebugMessageHandler::HandleWatchpointHit(const debug_watchpoint_hit
& message
)
98 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT
,
99 (const debug_debugger_message_data
&)message
);
104 BDebugMessageHandler::HandleSingleStep(const debug_single_step
& message
)
106 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_SINGLE_STEP
,
107 (const debug_debugger_message_data
&)message
);
112 BDebugMessageHandler::HandlePreSyscall(const debug_pre_syscall
& message
)
114 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_PRE_SYSCALL
,
115 (const debug_debugger_message_data
&)message
);
120 BDebugMessageHandler::HandlePostSyscall(const debug_post_syscall
& message
)
122 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_POST_SYSCALL
,
123 (const debug_debugger_message_data
&)message
);
128 BDebugMessageHandler::HandleSignalReceived(const debug_signal_received
& message
)
130 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED
,
131 (const debug_debugger_message_data
&)message
);
136 BDebugMessageHandler::HandleExceptionOccurred(
137 const debug_exception_occurred
& message
)
139 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED
,
140 (const debug_debugger_message_data
&)message
);
145 BDebugMessageHandler::HandleTeamCreated(const debug_team_created
& message
)
147 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_TEAM_CREATED
,
148 (const debug_debugger_message_data
&)message
);
153 BDebugMessageHandler::HandleTeamDeleted(const debug_team_deleted
& message
)
155 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_TEAM_DELETED
,
156 (const debug_debugger_message_data
&)message
);
161 BDebugMessageHandler::HandleTeamExec(const debug_team_exec
& message
)
163 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_TEAM_EXEC
,
164 (const debug_debugger_message_data
&)message
);
169 BDebugMessageHandler::HandleThreadCreated(const debug_thread_created
& message
)
171 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_THREAD_CREATED
,
172 (const debug_debugger_message_data
&)message
);
177 BDebugMessageHandler::HandleThreadDeleted(const debug_thread_deleted
& message
)
179 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_THREAD_DELETED
,
180 (const debug_debugger_message_data
&)message
);
185 BDebugMessageHandler::HandleImageCreated(const debug_image_created
& message
)
187 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_IMAGE_CREATED
,
188 (const debug_debugger_message_data
&)message
);
193 BDebugMessageHandler::HandleImageDeleted(const debug_image_deleted
& message
)
195 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_IMAGE_DELETED
,
196 (const debug_debugger_message_data
&)message
);
201 BDebugMessageHandler::HandleProfilerUpdate(const debug_profiler_update
& message
)
203 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_PROFILER_UPDATE
,
204 (const debug_debugger_message_data
&)message
);
209 BDebugMessageHandler::HandleHandedOver(const debug_handed_over
& message
)
211 return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_HANDED_OVER
,
212 (const debug_debugger_message_data
&)message
);
216 /*! Called by the base class versions of the specific Handle*() methods.
217 Can be overridded to handle any message not handled otherwise.
220 BDebugMessageHandler::UnhandledDebugMessage(int32 messageCode
,
221 const debug_debugger_message_data
& message
)