OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #include "debugger/core/debug_event.h" | |
5 #include <string> | |
6 | |
7 namespace debug { | |
8 DebugEvent::DebugEvent() | |
9 : nacl_debug_event_code_(kNotNaClDebugEvent) { | |
10 memset(&windows_debug_event_, 0, sizeof(windows_debug_event_)); | |
11 } | |
12 | |
13 bool DebugEvent::IsBreakpoint() const { | |
14 return EXCEPTION_BREAKPOINT == GetExceptionCode(); | |
15 } | |
16 | |
17 bool DebugEvent::IsSingleStep() const { | |
18 return EXCEPTION_SINGLE_STEP == GetExceptionCode(); | |
19 } | |
20 | |
21 int DebugEvent::GetExceptionCode() const { | |
22 if (EXCEPTION_DEBUG_EVENT != windows_debug_event_.dwDebugEventCode) | |
23 return 0; | |
24 return windows_debug_event_.u.Exception.ExceptionRecord.ExceptionCode; | |
25 } | |
26 | |
27 void DebugEvent::ToString(char* buff, size_t size) const { | |
28 _snprintf_s( | |
29 buff, | |
30 size - 1, | |
31 _TRUNCATE, | |
32 "dwDebugEventCode=0x%X dwProcessId=0x%X dwThreadId=0x%X NaClEventId=%d", | |
33 windows_debug_event_.dwDebugEventCode, | |
34 windows_debug_event_.dwProcessId, | |
35 windows_debug_event_.dwThreadId, | |
36 nacl_debug_event_code_); | |
37 buff[size - 1] = 0; | |
38 } | |
39 } // namespace debug | |
40 | |
OLD | NEW |