73 lines · cpp
1//===-- LocalDebugDelegate.cpp --------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "LocalDebugDelegate.h"10#include "ProcessWindows.h"11 12using namespace lldb;13using namespace lldb_private;14 15LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)16 : m_process(process) {}17 18void LocalDebugDelegate::OnExitProcess(uint32_t exit_code) {19 if (ProcessWindowsSP process = GetProcessPointer())20 process->OnExitProcess(exit_code);21}22 23void LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base) {24 if (ProcessWindowsSP process = GetProcessPointer())25 process->OnDebuggerConnected(image_base);26}27 28ExceptionResult29LocalDebugDelegate::OnDebugException(bool first_chance,30 const ExceptionRecord &record) {31 if (ProcessWindowsSP process = GetProcessPointer())32 return process->OnDebugException(first_chance, record);33 else34 return ExceptionResult::MaskException;35}36 37void LocalDebugDelegate::OnCreateThread(const HostThread &thread) {38 if (ProcessWindowsSP process = GetProcessPointer())39 process->OnCreateThread(thread);40}41 42void LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id,43 uint32_t exit_code) {44 if (ProcessWindowsSP process = GetProcessPointer())45 process->OnExitThread(thread_id, exit_code);46}47 48void LocalDebugDelegate::OnLoadDll(const lldb_private::ModuleSpec &module_spec,49 lldb::addr_t module_addr) {50 if (ProcessWindowsSP process = GetProcessPointer())51 process->OnLoadDll(module_spec, module_addr);52}53 54void LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr) {55 if (ProcessWindowsSP process = GetProcessPointer())56 process->OnUnloadDll(module_addr);57}58 59void LocalDebugDelegate::OnDebugString(const std::string &string) {60 if (ProcessWindowsSP process = GetProcessPointer())61 process->OnDebugString(string);62}63 64void LocalDebugDelegate::OnDebuggerError(const Status &error, uint32_t type) {65 if (ProcessWindowsSP process = GetProcessPointer())66 process->OnDebuggerError(error, type);67}68 69ProcessWindowsSP LocalDebugDelegate::GetProcessPointer() {70 ProcessSP process = m_process.lock();71 return std::static_pointer_cast<ProcessWindows>(process);72}73