]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/OperatingSystem.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Target / OperatingSystem.h
1 //===-- OperatingSystem.h ----------------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef liblldb_OperatingSystem_h_
12 #define liblldb_OperatingSystem_h_
13
14 // C Includes
15 // C++ Includes
16 // Other libraries and framework includes
17
18 #include "lldb/Core/PluginInterface.h"
19 #include "lldb/lldb-private.h"
20
21 namespace lldb_private {
22
23 //----------------------------------------------------------------------
24 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
25 /// A plug-in interface definition class for halted OS helpers.
26 ///
27 /// Halted OS plug-ins can be used by any process to locate and create
28 /// OS objects, like threads, during the lifetime of a debug session.
29 /// This is commonly used when attaching to an operating system that is
30 /// halted, such as when debugging over JTAG or connecting to low level kernel
31 /// debug services.
32 //----------------------------------------------------------------------
33
34 class OperatingSystem : public PluginInterface {
35 public:
36   //------------------------------------------------------------------
37   /// Find a halted OS plugin for a given process.
38   ///
39   /// Scans the installed OperatingSystem plug-ins and tries to find an
40   /// instance that matches the current target triple and executable.
41   ///
42   /// @param[in] process
43   ///     The process for which to try and locate a halted OS
44   ///     plug-in instance.
45   ///
46   /// @param[in] plugin_name
47   ///     An optional name of a specific halted OS plug-in that
48   ///     should be used. If NULL, pick the best plug-in.
49   //------------------------------------------------------------------
50   static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
51
52   //------------------------------------------------------------------
53   // Class Methods
54   //------------------------------------------------------------------
55   OperatingSystem(Process *process);
56
57   ~OperatingSystem() override;
58
59   //------------------------------------------------------------------
60   // Plug-in Methods
61   //------------------------------------------------------------------
62   virtual bool UpdateThreadList(ThreadList &old_thread_list,
63                                 ThreadList &real_thread_list,
64                                 ThreadList &new_thread_list) = 0;
65
66   virtual void ThreadWasSelected(Thread *thread) = 0;
67
68   virtual lldb::RegisterContextSP
69   CreateRegisterContextForThread(Thread *thread,
70                                  lldb::addr_t reg_data_addr) = 0;
71
72   virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
73
74   virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
75     return lldb::ThreadSP();
76   }
77
78   virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
79
80 protected:
81   //------------------------------------------------------------------
82   // Member variables.
83   //------------------------------------------------------------------
84   Process
85       *m_process; ///< The process that this dynamic loader plug-in is tracking.
86 private:
87   DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
88 };
89
90 } // namespace lldb_private
91
92 #endif // liblldb_OperatingSystem_h_