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_
15 #include "lldb/Core/PluginInterface.h"
16 #include "lldb/lldb-private.h"
18 namespace lldb_private {
20 //----------------------------------------------------------------------
21 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
22 /// A plug-in interface definition class for halted OS helpers.
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
29 //----------------------------------------------------------------------
31 class OperatingSystem : public PluginInterface {
33 //------------------------------------------------------------------
34 /// Find a halted OS plugin for a given process.
36 /// Scans the installed OperatingSystem plug-ins and tries to find an
37 /// instance that matches the current target triple and executable.
39 /// @param[in] process
40 /// The process for which to try and locate a halted OS
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);
49 //------------------------------------------------------------------
51 //------------------------------------------------------------------
52 OperatingSystem(Process *process);
54 ~OperatingSystem() override;
56 //------------------------------------------------------------------
58 //------------------------------------------------------------------
59 virtual bool UpdateThreadList(ThreadList &old_thread_list,
60 ThreadList &real_thread_list,
61 ThreadList &new_thread_list) = 0;
63 virtual void ThreadWasSelected(Thread *thread) = 0;
65 virtual lldb::RegisterContextSP
66 CreateRegisterContextForThread(Thread *thread,
67 lldb::addr_t reg_data_addr) = 0;
69 virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
71 virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
72 return lldb::ThreadSP();
75 virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
78 //------------------------------------------------------------------
80 //------------------------------------------------------------------
82 *m_process; ///< The process that this dynamic loader plug-in is tracking.
84 DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
87 } // namespace lldb_private
89 #endif // liblldb_OperatingSystem_h_