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