blob: a0ac9725c7560ecc1579b807d94c987febfb9a91 [file] [log] [blame]
Adrian McCarthy18a9135d2015-10-28 18:21:45 +00001//===-- 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
13using namespace lldb;
14using namespace lldb_private;
15
16LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)
17 : m_process(process)
18{
19}
20
21void
22LocalDebugDelegate::OnExitProcess(uint32_t exit_code)
23{
24 if (ProcessWindowsLiveSP process = GetProcessPointer())
25 process->OnExitProcess(exit_code);
26}
27
28void
29LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base)
30{
31 if (ProcessWindowsLiveSP process = GetProcessPointer())
32 process->OnDebuggerConnected(image_base);
33}
34
35ExceptionResult
36LocalDebugDelegate::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
44void
45LocalDebugDelegate::OnCreateThread(const HostThread &thread)
46{
47 if (ProcessWindowsLiveSP process = GetProcessPointer())
48 process->OnCreateThread(thread);
49}
50
51void
52LocalDebugDelegate::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
58void
59LocalDebugDelegate::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
65void
66LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr)
67{
68 if (ProcessWindowsLiveSP process = GetProcessPointer())
69 process->OnUnloadDll(module_addr);
70}
71
72void
73LocalDebugDelegate::OnDebugString(const std::string &string)
74{
75 if (ProcessWindowsLiveSP process = GetProcessPointer())
76 process->OnDebugString(string);
77}
78
79void
80LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type)
81{
82 if (ProcessWindowsLiveSP process = GetProcessPointer())
83 process->OnDebuggerError(error, type);
84}
85
86ProcessWindowsLiveSP
87LocalDebugDelegate::GetProcessPointer()
88{
89 ProcessSP process = m_process.lock();
90 return std::static_pointer_cast<ProcessWindowsLive>(process);
91}