]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Target/OperatingSystem.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / 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 /// @brief 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
31 /// kernel 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
40   /// an instance that matches the current target triple and
41   /// executable.
42   ///
43   /// @param[in] process
44   ///     The process for which to try and locate a halted OS
45   ///     plug-in instance.
46   ///
47   /// @param[in] plugin_name
48   ///     An optional name of a specific halted OS plug-in that
49   ///     should be used. If NULL, pick the best plug-in.
50   //------------------------------------------------------------------
51   static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
52
53   //------------------------------------------------------------------
54   // Class Methods
55   //------------------------------------------------------------------
56   OperatingSystem(Process *process);
57
58   ~OperatingSystem() override;
59
60   //------------------------------------------------------------------
61   // Plug-in Methods
62   //------------------------------------------------------------------
63   virtual bool UpdateThreadList(ThreadList &old_thread_list,
64                                 ThreadList &real_thread_list,
65                                 ThreadList &new_thread_list) = 0;
66
67   virtual void ThreadWasSelected(Thread *thread) = 0;
68
69   virtual lldb::RegisterContextSP
70   CreateRegisterContextForThread(Thread *thread,
71                                  lldb::addr_t reg_data_addr) = 0;
72
73   virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
74
75   virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
76     return lldb::ThreadSP();
77   }
78
79   virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
80
81 protected:
82   //------------------------------------------------------------------
83   // Member variables.
84   //------------------------------------------------------------------
85   Process
86       *m_process; ///< The process that this dynamic loader plug-in is tracking.
87 private:
88   DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
89 };
90
91 } // namespace lldb_private
92
93 #endif // liblldb_OperatingSystem_h_