Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +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 "ProcessWindows.h"
|
| 12 |
|
| 13 | using namespace lldb;
|
| 14 | using namespace lldb_private;
|
| 15 |
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 16 | LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 17 | : m_process(process)
|
| 18 | {
|
| 19 | }
|
| 20 |
|
| 21 | void
|
| 22 | LocalDebugDelegate::OnExitProcess(uint32_t exit_code)
|
| 23 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 24 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 25 | process->OnExitProcess(exit_code);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 26 | }
|
| 27 |
|
| 28 | void
|
| 29 | LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base)
|
| 30 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 31 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 32 | process->OnDebuggerConnected(image_base);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 33 | }
|
| 34 |
|
| 35 | ExceptionResult
|
| 36 | LocalDebugDelegate::OnDebugException(bool first_chance, const ExceptionRecord &record)
|
| 37 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 38 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 39 | return process->OnDebugException(first_chance, record);
|
| 40 | else
|
| 41 | return ExceptionResult::MaskException;
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 42 | }
|
| 43 |
|
| 44 | void
|
| 45 | LocalDebugDelegate::OnCreateThread(const HostThread &thread)
|
| 46 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 47 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 48 | process->OnCreateThread(thread);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 49 | }
|
| 50 |
|
| 51 | void
|
| 52 | LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code)
|
| 53 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 54 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 55 | process->OnExitThread(thread_id, exit_code);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 56 | }
|
| 57 |
|
| 58 | void
|
| 59 | LocalDebugDelegate::OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr)
|
| 60 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 61 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 62 | process->OnLoadDll(module_spec, module_addr);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 63 | }
|
| 64 |
|
| 65 | void
|
| 66 | LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr)
|
| 67 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 68 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 69 | process->OnUnloadDll(module_addr);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 70 | }
|
| 71 |
|
| 72 | void
|
| 73 | LocalDebugDelegate::OnDebugString(const std::string &string)
|
| 74 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 75 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 76 | process->OnDebugString(string);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 77 | }
|
| 78 |
|
| 79 | void
|
| 80 | LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type)
|
| 81 | {
|
Zachary Turner | 1d397bf | 2015-09-01 20:02:44 +0000 | [diff] [blame^] | 82 | if (ProcessWindowsSP process = GetProcessPointer())
|
| 83 | process->OnDebuggerError(error, type);
|
| 84 | }
|
| 85 |
|
| 86 | ProcessWindowsSP
|
| 87 | LocalDebugDelegate::GetProcessPointer()
|
| 88 | {
|
| 89 | ProcessSP process = m_process.lock();
|
| 90 | return std::static_pointer_cast<ProcessWindows>(process);
|
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 91 | }
|