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 /// 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 kernel
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 an
40 /// instance that matches the current target triple and executable.
42 /// @param[in] process
43 /// The process for which to try and locate a halted OS
46 /// @param[in] plugin_name
47 /// An optional name of a specific halted OS plug-in that
48 /// should be used. If NULL, pick the best plug-in.
49 //------------------------------------------------------------------
50 static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
52 //------------------------------------------------------------------
54 //------------------------------------------------------------------
55 OperatingSystem(Process *process);
57 ~OperatingSystem() override;
59 //------------------------------------------------------------------
61 //------------------------------------------------------------------
62 virtual bool UpdateThreadList(ThreadList &old_thread_list,
63 ThreadList &real_thread_list,
64 ThreadList &new_thread_list) = 0;
66 virtual void ThreadWasSelected(Thread *thread) = 0;
68 virtual lldb::RegisterContextSP
69 CreateRegisterContextForThread(Thread *thread,
70 lldb::addr_t reg_data_addr) = 0;
72 virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
74 virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
75 return lldb::ThreadSP();
78 virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
81 //------------------------------------------------------------------
83 //------------------------------------------------------------------
85 *m_process; ///< The process that this dynamic loader plug-in is tracking.
87 DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
90 } // namespace lldb_private
92 #endif // liblldb_OperatingSystem_h_