OperatingSystem.h revision ae932359b80098532f3c3766fa9e6527352fbb67
1//===-- OperatingSystem.h ----------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_OperatingSystem_h_
11#define liblldb_OperatingSystem_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16
17#include "lldb/lldb-private.h"
18#include "lldb/Core/PluginInterface.h"
19
20namespace lldb_private {
21
22//----------------------------------------------------------------------
23/// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
24/// @brief A plug-in interface definition class for halted OS helpers.
25///
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//----------------------------------------------------------------------
32
33class OperatingSystem :
34    public PluginInterface
35
36{
37public:
38    //------------------------------------------------------------------
39    /// Find a halted OS plugin for a given process.
40    ///
41    /// Scans the installed OperatingSystem plug-ins and tries to find
42    /// an instance that matches the current target triple and
43    /// executable.
44    ///
45    /// @param[in] process
46    ///     The process for which to try and locate a halted OS
47    ///     plug-in instance.
48    ///
49    /// @param[in] plugin_name
50    ///     An optional name of a specific halted OS plug-in that
51    ///     should be used. If NULL, pick the best plug-in.
52    //------------------------------------------------------------------
53    static OperatingSystem*
54    FindPlugin (Process *process, const char *plugin_name);
55
56    //------------------------------------------------------------------
57    // Class Methods
58    //------------------------------------------------------------------
59    OperatingSystem (Process *process);
60
61    virtual
62    ~OperatingSystem();
63
64    //------------------------------------------------------------------
65    // Plug-in Methods
66    //------------------------------------------------------------------
67    virtual bool
68    UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) = 0;
69
70    virtual void
71    ThreadWasSelected (Thread *thread) = 0;
72
73    virtual lldb::RegisterContextSP
74    CreateRegisterContextForThread (Thread *thread) = 0;
75
76    virtual lldb::StopInfoSP
77    CreateThreadStopReason (Thread *thread) = 0;
78
79protected:
80    //------------------------------------------------------------------
81    // Member variables.
82    //------------------------------------------------------------------
83    Process* m_process; ///< The process that this dynamic loader plug-in is tracking.
84private:
85    DISALLOW_COPY_AND_ASSIGN (OperatingSystem);
86};
87
88} // namespace lldb_private
89
90#endif // #ifndef liblldb_OperatingSystem_h_
91