Adrian McCarthy | 18a9135d | 2015-10-28 18:21:45 +0000 | [diff] [blame^] | 1 | //===-- LocalDebugDelegate.cpp ----------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "LocalDebugDelegate.h" |
| 11 | #include "ProcessWindowsLive.h" |
| 12 | |
| 13 | using namespace lldb; |
| 14 | using namespace lldb_private; |
| 15 | |
| 16 | LocalDebugDelegate::LocalDebugDelegate(ProcessWP process) |
| 17 | : m_process(process) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | void |
| 22 | LocalDebugDelegate::OnExitProcess(uint32_t exit_code) |
| 23 | { |
| 24 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 25 | process->OnExitProcess(exit_code); |
| 26 | } |
| 27 | |
| 28 | void |
| 29 | LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base) |
| 30 | { |
| 31 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 32 | process->OnDebuggerConnected(image_base); |
| 33 | } |
| 34 | |
| 35 | ExceptionResult |
| 36 | LocalDebugDelegate::OnDebugException(bool first_chance, const ExceptionRecord &record) |
| 37 | { |
| 38 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 39 | return process->OnDebugException(first_chance, record); |
| 40 | else |
| 41 | return ExceptionResult::MaskException; |
| 42 | } |
| 43 | |
| 44 | void |
| 45 | LocalDebugDelegate::OnCreateThread(const HostThread &thread) |
| 46 | { |
| 47 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 48 | process->OnCreateThread(thread); |
| 49 | } |
| 50 | |
| 51 | void |
| 52 | LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) |
| 53 | { |
| 54 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 55 | process->OnExitThread(thread_id, exit_code); |
| 56 | } |
| 57 | |
| 58 | void |
| 59 | LocalDebugDelegate::OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) |
| 60 | { |
| 61 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 62 | process->OnLoadDll(module_spec, module_addr); |
| 63 | } |
| 64 | |
| 65 | void |
| 66 | LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr) |
| 67 | { |
| 68 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 69 | process->OnUnloadDll(module_addr); |
| 70 | } |
| 71 | |
| 72 | void |
| 73 | LocalDebugDelegate::OnDebugString(const std::string &string) |
| 74 | { |
| 75 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 76 | process->OnDebugString(string); |
| 77 | } |
| 78 | |
| 79 | void |
| 80 | LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type) |
| 81 | { |
| 82 | if (ProcessWindowsLiveSP process = GetProcessPointer()) |
| 83 | process->OnDebuggerError(error, type); |
| 84 | } |
| 85 | |
| 86 | ProcessWindowsLiveSP |
| 87 | LocalDebugDelegate::GetProcessPointer() |
| 88 | { |
| 89 | ProcessSP process = m_process.lock(); |
| 90 | return std::static_pointer_cast<ProcessWindowsLive>(process); |
| 91 | } |