]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / Process / Windows / Common / LocalDebugDelegate.cpp
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 "ProcessWindows.h"
12
13 using namespace lldb;
14 using namespace lldb_private;
15
16 LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)
17     : m_process(process) {}
18
19 void LocalDebugDelegate::OnExitProcess(uint32_t exit_code) {
20   if (ProcessWindowsSP process = GetProcessPointer())
21     process->OnExitProcess(exit_code);
22 }
23
24 void LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base) {
25   if (ProcessWindowsSP process = GetProcessPointer())
26     process->OnDebuggerConnected(image_base);
27 }
28
29 ExceptionResult
30 LocalDebugDelegate::OnDebugException(bool first_chance,
31                                      const ExceptionRecord &record) {
32   if (ProcessWindowsSP process = GetProcessPointer())
33     return process->OnDebugException(first_chance, record);
34   else
35     return ExceptionResult::MaskException;
36 }
37
38 void LocalDebugDelegate::OnCreateThread(const HostThread &thread) {
39   if (ProcessWindowsSP process = GetProcessPointer())
40     process->OnCreateThread(thread);
41 }
42
43 void LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id,
44                                       uint32_t exit_code) {
45   if (ProcessWindowsSP process = GetProcessPointer())
46     process->OnExitThread(thread_id, exit_code);
47 }
48
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);
53 }
54
55 void LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr) {
56   if (ProcessWindowsSP process = GetProcessPointer())
57     process->OnUnloadDll(module_addr);
58 }
59
60 void LocalDebugDelegate::OnDebugString(const std::string &string) {
61   if (ProcessWindowsSP process = GetProcessPointer())
62     process->OnDebugString(string);
63 }
64
65 void LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type) {
66   if (ProcessWindowsSP process = GetProcessPointer())
67     process->OnDebuggerError(error, type);
68 }
69
70 ProcessWindowsSP LocalDebugDelegate::GetProcessPointer() {
71   ProcessSP process = m_process.lock();
72   return std::static_pointer_cast<ProcessWindows>(process);
73 }