1 //===-- PlatformLinux.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_PlatformLinux_h_
11 #define liblldb_PlatformLinux_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "Plugins/Platform/POSIX/PlatformPOSIX.h"
18 
19 namespace lldb_private {
20 
21     class PlatformLinux : public PlatformPOSIX
22     {
23     public:
24 
25         static void
26         DebuggerInitialize (lldb_private::Debugger &debugger);
27 
28         static void
29         Initialize ();
30 
31         static void
32         Terminate ();
33 
34         PlatformLinux (bool is_host);
35 
36         virtual
37         ~PlatformLinux();
38 
39         //------------------------------------------------------------
40         // lldb_private::PluginInterface functions
41         //------------------------------------------------------------
42         static lldb::PlatformSP
43         CreateInstance (bool force, const lldb_private::ArchSpec *arch);
44 
45         static lldb_private::ConstString
46         GetPluginNameStatic (bool is_host);
47 
48         static const char *
49         GetPluginDescriptionStatic (bool is_host);
50 
51         lldb_private::ConstString
52         GetPluginName() override;
53 
54         uint32_t
55         GetPluginVersion() override
56         {
57             return 1;
58         }
59 
60         //------------------------------------------------------------
61         // lldb_private::Platform functions
62         //------------------------------------------------------------
63         Error
64         ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
65                            lldb::ModuleSP &module_sp,
66                            const FileSpecList *module_search_paths_ptr) override;
67 
68         const char *
69         GetDescription () override
70         {
71             return GetPluginDescriptionStatic(IsHost());
72         }
73 
74         void
75         GetStatus (Stream &strm) override;
76 
77         Error
78         GetFileWithUUID (const FileSpec &platform_file,
79                          const UUID* uuid, FileSpec &local_file) override;
80 
81         bool
82         GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
83 
84         uint32_t
85         FindProcesses (const ProcessInstanceInfoMatch &match_info,
86                        ProcessInstanceInfoList &process_infos) override;
87 
88         bool
89         GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) override;
90 
91         size_t
92         GetSoftwareBreakpointTrapOpcode (Target &target,
93                                          BreakpointSite *bp_site) override;
94 
95         int32_t
96         GetResumeCountForLaunchInfo (ProcessLaunchInfo &launch_info) override;
97 
98         bool
99         CanDebugProcess () override;
100 
101         lldb::ProcessSP
102         DebugProcess (ProcessLaunchInfo &launch_info,
103                       Debugger &debugger,
104                       Target *target,
105                       Error &error) override;
106 
107         void
108         CalculateTrapHandlerSymbolNames () override;
109 
110         Error
111         LaunchNativeProcess (
112             ProcessLaunchInfo &launch_info,
113             lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
114             NativeProcessProtocolSP &process_sp) override;
115 
116         Error
117         AttachNativeProcess (lldb::pid_t pid,
118                              lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
119                              NativeProcessProtocolSP &process_sp) override;
120 
121         static bool
122         UseLlgsForLocalDebugging ();
123 
124     private:
125         DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
126     };
127 } // namespace lldb_private
128 
129 #endif  // liblldb_PlatformLinux_h_
130