1 //===-- LocalDebugDelegate.cpp ----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "LocalDebugDelegate.h"
11 #include "ProcessWindows.h"
14 using namespace lldb_private;
16 LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)
17 : m_process(process) {}
19 void LocalDebugDelegate::OnExitProcess(uint32_t exit_code) {
20 if (ProcessWindowsSP process = GetProcessPointer())
21 process->OnExitProcess(exit_code);
24 void LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base) {
25 if (ProcessWindowsSP process = GetProcessPointer())
26 process->OnDebuggerConnected(image_base);
30 LocalDebugDelegate::OnDebugException(bool first_chance,
31 const ExceptionRecord &record) {
32 if (ProcessWindowsSP process = GetProcessPointer())
33 return process->OnDebugException(first_chance, record);
35 return ExceptionResult::MaskException;
38 void LocalDebugDelegate::OnCreateThread(const HostThread &thread) {
39 if (ProcessWindowsSP process = GetProcessPointer())
40 process->OnCreateThread(thread);
43 void LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id,
45 if (ProcessWindowsSP process = GetProcessPointer())
46 process->OnExitThread(thread_id, exit_code);
49 void LocalDebugDelegate::OnLoadDll(const lldb_private::ModuleSpec &module_spec,
50 lldb::addr_t module_addr) {
51 if (ProcessWindowsSP process = GetProcessPointer())
52 process->OnLoadDll(module_spec, module_addr);
55 void LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr) {
56 if (ProcessWindowsSP process = GetProcessPointer())
57 process->OnUnloadDll(module_addr);
60 void LocalDebugDelegate::OnDebugString(const std::string &string) {
61 if (ProcessWindowsSP process = GetProcessPointer())
62 process->OnDebugString(string);
65 void LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type) {
66 if (ProcessWindowsSP process = GetProcessPointer())
67 process->OnDebuggerError(error, type);
70 ProcessWindowsSP LocalDebugDelegate::GetProcessPointer() {
71 ProcessSP process = m_process.lock();
72 return std::static_pointer_cast<ProcessWindows>(process);