]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Target/OperatingSystem.h
Vendor import of lldb trunk r351319 (just before the release_80 branch
[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
15 #include "lldb/Core/PluginInterface.h"
16 #include "lldb/lldb-private.h"
17
18 namespace lldb_private {
19
20 //----------------------------------------------------------------------
21 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
22 /// A plug-in interface definition class for halted OS helpers.
23 ///
24 /// Halted OS plug-ins can be used by any process to locate and create
25 /// OS objects, like threads, during the lifetime of a debug session.
26 /// This is commonly used when attaching to an operating system that is
27 /// halted, such as when debugging over JTAG or connecting to low level kernel
28 /// debug services.
29 //----------------------------------------------------------------------
30
31 class OperatingSystem : public PluginInterface {
32 public:
33   //------------------------------------------------------------------
34   /// Find a halted OS plugin for a given process.
35   ///
36   /// Scans the installed OperatingSystem plug-ins and tries to find an
37   /// instance that matches the current target triple and executable.
38   ///
39   /// @param[in] process
40   ///     The process for which to try and locate a halted OS
41   ///     plug-in instance.
42   ///
43   /// @param[in] plugin_name
44   ///     An optional name of a specific halted OS plug-in that
45   ///     should be used. If NULL, pick the best plug-in.
46   //------------------------------------------------------------------
47   static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
48
49   //------------------------------------------------------------------
50   // Class Methods
51   //------------------------------------------------------------------
52   OperatingSystem(Process *process);
53
54   ~OperatingSystem() override;
55
56   //------------------------------------------------------------------
57   // Plug-in Methods
58   //------------------------------------------------------------------
59   virtual bool UpdateThreadList(ThreadList &old_thread_list,
60                                 ThreadList &real_thread_list,
61                                 ThreadList &new_thread_list) = 0;
62
63   virtual void ThreadWasSelected(Thread *thread) = 0;
64
65   virtual lldb::RegisterContextSP
66   CreateRegisterContextForThread(Thread *thread,
67                                  lldb::addr_t reg_data_addr) = 0;
68
69   virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
70
71   virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
72     return lldb::ThreadSP();
73   }
74
75   virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
76
77 protected:
78   //------------------------------------------------------------------
79   // Member variables.
80   //------------------------------------------------------------------
81   Process
82       *m_process; ///< The process that this dynamic loader plug-in is tracking.
83 private:
84   DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
85 };
86
87 } // namespace lldb_private
88
89 #endif // liblldb_OperatingSystem_h_