1 //===-- OperatingSystem.h ----------------------------------------------*- C++
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef liblldb_OperatingSystem_h_
12 #define liblldb_OperatingSystem_h_
16 // Other libraries and framework includes
18 #include "lldb/Core/PluginInterface.h"
19 #include "lldb/lldb-private.h"
21 namespace lldb_private {
23 //----------------------------------------------------------------------
24 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
25 /// @brief A plug-in interface definition class for halted OS helpers.
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 //----------------------------------------------------------------------
34 class OperatingSystem : public PluginInterface {
36 //------------------------------------------------------------------
37 /// Find a halted OS plugin for a given process.
39 /// Scans the installed OperatingSystem plug-ins and tries to find
40 /// an instance that matches the current target triple and
43 /// @param[in] process
44 /// The process for which to try and locate a halted OS
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);
53 //------------------------------------------------------------------
55 //------------------------------------------------------------------
56 OperatingSystem(Process *process);
58 ~OperatingSystem() override;
60 //------------------------------------------------------------------
62 //------------------------------------------------------------------
63 virtual bool UpdateThreadList(ThreadList &old_thread_list,
64 ThreadList &real_thread_list,
65 ThreadList &new_thread_list) = 0;
67 virtual void ThreadWasSelected(Thread *thread) = 0;
69 virtual lldb::RegisterContextSP
70 CreateRegisterContextForThread(Thread *thread,
71 lldb::addr_t reg_data_addr) = 0;
73 virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
75 virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
76 return lldb::ThreadSP();
79 virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
82 //------------------------------------------------------------------
84 //------------------------------------------------------------------
86 *m_process; ///< The process that this dynamic loader plug-in is tracking.
88 DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
91 } // namespace lldb_private
93 #endif // liblldb_OperatingSystem_h_