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 "lldb/Target/Platform.h"
18 
19 namespace lldb_private {
20 
21     class PlatformLinux : public Platform
22     {
23     public:
24 
25         static void
26         Initialize ();
27 
28         static void
29         Terminate ();
30 
31         PlatformLinux (bool is_host);
32 
33         virtual
34         ~PlatformLinux();
35 
36         //------------------------------------------------------------
37         // lldb_private::PluginInterface functions
38         //------------------------------------------------------------
39         static Platform *
40         CreateInstance (bool force, const lldb_private::ArchSpec *arch);
41 
42         static const char *
43         GetPluginNameStatic();
44 
45         static const char *
46         GetShortPluginNameStatic(bool is_host);
47 
48         static const char *
49         GetPluginDescriptionStatic(bool is_host);
50 
51         virtual const char *
52         GetPluginName()
53         {
54             return GetPluginNameStatic();
55         }
56 
57         virtual const char *
58         GetShortPluginName()
59         {
60             return "PlatformLinux";
61         }
62 
63         virtual uint32_t
64         GetPluginVersion()
65         {
66             return 1;
67         }
68 
69         //------------------------------------------------------------
70         // lldb_private::Platform functions
71         //------------------------------------------------------------
72         virtual Error
73         ResolveExecutable (const FileSpec &exe_file,
74                            const ArchSpec &arch,
75                            lldb::ModuleSP &module_sp,
76                            const FileSpecList *module_search_paths_ptr);
77 
78         virtual const char *
79         GetDescription ()
80         {
81             return GetPluginDescriptionStatic(IsHost());
82         }
83 
84         virtual void
85         GetStatus (Stream &strm);
86 
87         virtual Error
88         GetFile (const FileSpec &platform_file,
89                  const UUID* uuid, FileSpec &local_file);
90 
91         virtual bool
92         GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
93 
94         virtual bool
95         GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
96 
97         virtual size_t
98         GetSoftwareBreakpointTrapOpcode (Target &target,
99                                          BreakpointSite *bp_site);
100 
101         virtual lldb_private::Error
102         LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
103 
104         virtual lldb::ProcessSP
105         Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
106                Target *target, Listener &listener, Error &error);
107 
108         // Linux processes can not be launched by spawning and attaching.
109         virtual bool
110         CanDebugProcess ()
111         {
112             return false;
113         }
114 
115     protected:
116         lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote darwin OS
117 
118     private:
119         DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
120     };
121 } // namespace lldb_private
122 
123 #endif  // liblldb_PlatformLinux_h_
124