1 //===-- OperatingSystem.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OperatingSystem_h_
11 #define liblldb_OperatingSystem_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Core/PluginInterface.h"
20 namespace lldb_private {
22 //----------------------------------------------------------------------
23 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
24 /// @brief A plug-in interface definition class for halted OS helpers.
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 //----------------------------------------------------------------------
33 class OperatingSystem :
34 public PluginInterface
37 //------------------------------------------------------------------
38 /// Find a halted OS plugin for a given process.
40 /// Scans the installed OperatingSystem plug-ins and tries to find
41 /// an instance that matches the current target triple and
44 /// @param[in] process
45 /// The process for which to try and locate a halted OS
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);
55 //------------------------------------------------------------------
57 //------------------------------------------------------------------
58 OperatingSystem (Process *process);
60 ~OperatingSystem() override;
62 //------------------------------------------------------------------
64 //------------------------------------------------------------------
66 UpdateThreadList (ThreadList &old_thread_list,
67 ThreadList &real_thread_list,
68 ThreadList &new_thread_list) = 0;
71 ThreadWasSelected (Thread *thread) = 0;
73 virtual lldb::RegisterContextSP
74 CreateRegisterContextForThread (Thread *thread, lldb::addr_t reg_data_addr) = 0;
76 virtual lldb::StopInfoSP
77 CreateThreadStopReason (Thread *thread) = 0;
79 virtual lldb::ThreadSP
80 CreateThread (lldb::tid_t tid, lldb::addr_t context)
82 return lldb::ThreadSP();
86 IsOperatingSystemPluginThread (const lldb::ThreadSP &thread_sp);
89 //------------------------------------------------------------------
91 //------------------------------------------------------------------
92 Process* m_process; ///< The process that this dynamic loader plug-in is tracking.
94 DISALLOW_COPY_AND_ASSIGN (OperatingSystem);
97 } // namespace lldb_private
99 #endif // liblldb_OperatingSystem_h_