1//===-- OperatingSystem.h ----------------------------------------------*- C++ 2//-*-===// 3// 4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5// See https://llvm.org/LICENSE.txt for license information. 6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLDB_TARGET_OPERATINGSYSTEM_H 11#define LLDB_TARGET_OPERATINGSYSTEM_H 12 13#include "lldb/Core/PluginInterface.h" 14#include "lldb/lldb-private.h" 15 16namespace lldb_private { 17 18/// \class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h" 19/// A plug-in interface definition class for halted OS helpers. 20/// 21/// Halted OS plug-ins can be used by any process to locate and create 22/// OS objects, like threads, during the lifetime of a debug session. 23/// This is commonly used when attaching to an operating system that is 24/// halted, such as when debugging over JTAG or connecting to low level kernel 25/// debug services. 26 27class OperatingSystem : public PluginInterface { 28public: 29 /// Find a halted OS plugin for a given process. 30 /// 31 /// Scans the installed OperatingSystem plug-ins and tries to find an 32 /// instance that matches the current target triple and executable. 33 /// 34 /// \param[in] process 35 /// The process for which to try and locate a halted OS 36 /// plug-in instance. 37 /// 38 /// \param[in] plugin_name 39 /// An optional name of a specific halted OS plug-in that 40 /// should be used. If NULL, pick the best plug-in. 41 static OperatingSystem *FindPlugin(Process *process, const char *plugin_name); 42 43 OperatingSystem(Process *process); 44 45 // Plug-in Methods 46 virtual bool UpdateThreadList(ThreadList &old_thread_list, 47 ThreadList &real_thread_list, 48 ThreadList &new_thread_list) = 0; 49 50 virtual void ThreadWasSelected(Thread *thread) = 0; 51 52 virtual lldb::RegisterContextSP 53 CreateRegisterContextForThread(Thread *thread, 54 lldb::addr_t reg_data_addr) = 0; 55 56 virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0; 57 58 virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) { 59 return lldb::ThreadSP(); 60 } 61 62 virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp); 63 64protected: 65 // Member variables. 66 Process 67 *m_process; ///< The process that this dynamic loader plug-in is tracking. 68}; 69 70} // namespace lldb_private 71 72#endif // LLDB_TARGET_OPERATINGSYSTEM_H 73