Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:53

0001 //===-- OperatingSystem.h ----------------------------------------------*- C++
0002 //-*-===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef LLDB_TARGET_OPERATINGSYSTEM_H
0011 #define LLDB_TARGET_OPERATINGSYSTEM_H
0012 
0013 #include "lldb/Core/PluginInterface.h"
0014 #include "lldb/lldb-private.h"
0015 
0016 namespace lldb_private {
0017 
0018 /// \class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
0019 /// A plug-in interface definition class for halted OS helpers.
0020 ///
0021 /// Halted OS plug-ins can be used by any process to locate and create
0022 /// OS objects, like threads, during the lifetime of a debug session.
0023 /// This is commonly used when attaching to an operating system that is
0024 /// halted, such as when debugging over JTAG or connecting to low level kernel
0025 /// debug services.
0026 
0027 class OperatingSystem : public PluginInterface {
0028 public:
0029   /// Find a halted OS plugin for a given process.
0030   ///
0031   /// Scans the installed OperatingSystem plug-ins and tries to find an
0032   /// instance that matches the current target triple and executable.
0033   ///
0034   /// \param[in] process
0035   ///     The process for which to try and locate a halted OS
0036   ///     plug-in instance.
0037   ///
0038   /// \param[in] plugin_name
0039   ///     An optional name of a specific halted OS plug-in that
0040   ///     should be used. If NULL, pick the best plug-in.
0041   static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
0042 
0043   OperatingSystem(Process *process);
0044 
0045   // Plug-in Methods
0046   virtual bool UpdateThreadList(ThreadList &old_thread_list,
0047                                 ThreadList &real_thread_list,
0048                                 ThreadList &new_thread_list) = 0;
0049 
0050   virtual void ThreadWasSelected(Thread *thread) = 0;
0051 
0052   virtual lldb::RegisterContextSP
0053   CreateRegisterContextForThread(Thread *thread,
0054                                  lldb::addr_t reg_data_addr) = 0;
0055 
0056   virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
0057 
0058   virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
0059     return lldb::ThreadSP();
0060   }
0061 
0062   virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
0063 
0064   virtual bool DoesPluginReportAllThreads() = 0;
0065 
0066 protected:
0067   // Member variables.
0068   Process
0069       *m_process; ///< The process that this dynamic loader plug-in is tracking.
0070 };
0071 
0072 } // namespace lldb_private
0073 
0074 #endif // LLDB_TARGET_OPERATINGSYSTEM_H