1 //===-- ProcessLinux.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_ProcessLinux_H_
11 #define liblldb_ProcessLinux_H_
12 
13 // C Includes
14 
15 // C++ Includes
16 #include <queue>
17 
18 // Other libraries and framework includes
19 #include "lldb/Target/Process.h"
20 #include "LinuxSignals.h"
21 #include "ProcessMessage.h"
22 #include "ProcessPOSIX.h"
23 
24 class ProcessMonitor;
25 
26 class ProcessLinux :
27     public ProcessPOSIX
28 {
29 public:
30     //------------------------------------------------------------------
31     // Static functions.
32     //------------------------------------------------------------------
33     static lldb::ProcessSP
34     CreateInstance(lldb_private::Target& target,
35                    lldb_private::Listener &listener,
36                    const lldb_private::FileSpec *);
37 
38     static void
39     Initialize();
40 
41     static void
42     Terminate();
43 
44     static lldb_private::ConstString
45     GetPluginNameStatic();
46 
47     static const char *
48     GetPluginDescriptionStatic();
49 
50     //------------------------------------------------------------------
51     // Constructors and destructors
52     //------------------------------------------------------------------
53     ProcessLinux(lldb_private::Target& target,
54                  lldb_private::Listener &listener,
55                  lldb_private::FileSpec *core_file);
56 
57     virtual bool
58     UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list);
59 
60     //------------------------------------------------------------------
61     // PluginInterface protocol
62     //------------------------------------------------------------------
63     virtual lldb_private::ConstString
64     GetPluginName();
65 
66     virtual uint32_t
67     GetPluginVersion();
68 
69     virtual void
70     GetPluginCommandHelp(const char *command, lldb_private::Stream *strm);
71 
72     virtual lldb_private::Error
73     ExecutePluginCommand(lldb_private::Args &command,
74                          lldb_private::Stream *strm);
75 
76     virtual lldb_private::Log *
77     EnablePluginLogging(lldb_private::Stream *strm,
78                         lldb_private::Args &command);
79 
80     //------------------------------------------------------------------
81     // Plug-in process overrides
82     //------------------------------------------------------------------
83     virtual lldb_private::UnixSignals &
GetUnixSignals()84     GetUnixSignals ()
85     {
86         return m_linux_signals;
87     }
88 
89     virtual bool
90     CanDebug(lldb_private::Target &target, bool plugin_specified_by_name);
91 
92     //------------------------------------------------------------------
93     // ProcessPOSIX overrides
94     //------------------------------------------------------------------
95     virtual void
96     StopAllThreads(lldb::tid_t stop_tid);
97 
98     virtual POSIXThread *
99     CreateNewPOSIXThread(lldb_private::Process &process, lldb::tid_t tid);
100 
101 private:
102 
103     /// Linux-specific signal set.
104     LinuxSignals m_linux_signals;
105 
106     lldb_private::FileSpec *m_core_file;
107 
108     // Flag to avoid recursion when stopping all threads.
109     bool m_stopping_threads;
110 };
111 
112 #endif  // liblldb_MacOSXProcess_H_
113