1*80814287SRaphael Isemann //===-- LocalDebugDelegate.cpp --------------------------------------------===//
24ad5def9SAdrian McCarthy //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
64ad5def9SAdrian McCarthy //
74ad5def9SAdrian McCarthy //===----------------------------------------------------------------------===//
84ad5def9SAdrian McCarthy
94ad5def9SAdrian McCarthy #include "LocalDebugDelegate.h"
104ad5def9SAdrian McCarthy #include "ProcessWindows.h"
114ad5def9SAdrian McCarthy
124ad5def9SAdrian McCarthy using namespace lldb;
134ad5def9SAdrian McCarthy using namespace lldb_private;
144ad5def9SAdrian McCarthy
LocalDebugDelegate(ProcessWP process)154ad5def9SAdrian McCarthy LocalDebugDelegate::LocalDebugDelegate(ProcessWP process)
164ad5def9SAdrian McCarthy : m_process(process) {}
174ad5def9SAdrian McCarthy
OnExitProcess(uint32_t exit_code)184ad5def9SAdrian McCarthy void LocalDebugDelegate::OnExitProcess(uint32_t exit_code) {
194ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
204ad5def9SAdrian McCarthy process->OnExitProcess(exit_code);
214ad5def9SAdrian McCarthy }
224ad5def9SAdrian McCarthy
OnDebuggerConnected(lldb::addr_t image_base)234ad5def9SAdrian McCarthy void LocalDebugDelegate::OnDebuggerConnected(lldb::addr_t image_base) {
244ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
254ad5def9SAdrian McCarthy process->OnDebuggerConnected(image_base);
264ad5def9SAdrian McCarthy }
274ad5def9SAdrian McCarthy
284ad5def9SAdrian McCarthy ExceptionResult
OnDebugException(bool first_chance,const ExceptionRecord & record)294ad5def9SAdrian McCarthy LocalDebugDelegate::OnDebugException(bool first_chance,
304ad5def9SAdrian McCarthy const ExceptionRecord &record) {
314ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
324ad5def9SAdrian McCarthy return process->OnDebugException(first_chance, record);
334ad5def9SAdrian McCarthy else
344ad5def9SAdrian McCarthy return ExceptionResult::MaskException;
354ad5def9SAdrian McCarthy }
364ad5def9SAdrian McCarthy
OnCreateThread(const HostThread & thread)374ad5def9SAdrian McCarthy void LocalDebugDelegate::OnCreateThread(const HostThread &thread) {
384ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
394ad5def9SAdrian McCarthy process->OnCreateThread(thread);
404ad5def9SAdrian McCarthy }
414ad5def9SAdrian McCarthy
OnExitThread(lldb::tid_t thread_id,uint32_t exit_code)424ad5def9SAdrian McCarthy void LocalDebugDelegate::OnExitThread(lldb::tid_t thread_id,
434ad5def9SAdrian McCarthy uint32_t exit_code) {
444ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
454ad5def9SAdrian McCarthy process->OnExitThread(thread_id, exit_code);
464ad5def9SAdrian McCarthy }
474ad5def9SAdrian McCarthy
OnLoadDll(const lldb_private::ModuleSpec & module_spec,lldb::addr_t module_addr)484ad5def9SAdrian McCarthy void LocalDebugDelegate::OnLoadDll(const lldb_private::ModuleSpec &module_spec,
494ad5def9SAdrian McCarthy lldb::addr_t module_addr) {
504ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
514ad5def9SAdrian McCarthy process->OnLoadDll(module_spec, module_addr);
524ad5def9SAdrian McCarthy }
534ad5def9SAdrian McCarthy
OnUnloadDll(lldb::addr_t module_addr)544ad5def9SAdrian McCarthy void LocalDebugDelegate::OnUnloadDll(lldb::addr_t module_addr) {
554ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
564ad5def9SAdrian McCarthy process->OnUnloadDll(module_addr);
574ad5def9SAdrian McCarthy }
584ad5def9SAdrian McCarthy
OnDebugString(const std::string & string)594ad5def9SAdrian McCarthy void LocalDebugDelegate::OnDebugString(const std::string &string) {
604ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
614ad5def9SAdrian McCarthy process->OnDebugString(string);
624ad5def9SAdrian McCarthy }
634ad5def9SAdrian McCarthy
OnDebuggerError(const Status & error,uint32_t type)6497206d57SZachary Turner void LocalDebugDelegate::OnDebuggerError(const Status &error, uint32_t type) {
654ad5def9SAdrian McCarthy if (ProcessWindowsSP process = GetProcessPointer())
664ad5def9SAdrian McCarthy process->OnDebuggerError(error, type);
674ad5def9SAdrian McCarthy }
684ad5def9SAdrian McCarthy
GetProcessPointer()694ad5def9SAdrian McCarthy ProcessWindowsSP LocalDebugDelegate::GetProcessPointer() {
704ad5def9SAdrian McCarthy ProcessSP process = m_process.lock();
714ad5def9SAdrian McCarthy return std::static_pointer_cast<ProcessWindows>(process);
724ad5def9SAdrian McCarthy }
73