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 namespace platform_linux {
21 
22 class PlatformLinux : public PlatformPOSIX {
23 public:
24   PlatformLinux(bool is_host);
25 
26   ~PlatformLinux() override;
27 
28   static void DebuggerInitialize(Debugger &debugger);
29 
30   static void Initialize();
31 
32   static void Terminate();
33 
34   //------------------------------------------------------------
35   // lldb_private::PluginInterface functions
36   //------------------------------------------------------------
37   static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
38 
39   static ConstString GetPluginNameStatic(bool is_host);
40 
41   static const char *GetPluginDescriptionStatic(bool is_host);
42 
43   ConstString GetPluginName() override;
44 
45   uint32_t GetPluginVersion() override { return 1; }
46 
47   //------------------------------------------------------------
48   // lldb_private::Platform functions
49   //------------------------------------------------------------
50   Error ResolveExecutable(const ModuleSpec &module_spec,
51                           lldb::ModuleSP &module_sp,
52                           const FileSpecList *module_search_paths_ptr) override;
53 
54   const char *GetDescription() override {
55     return GetPluginDescriptionStatic(IsHost());
56   }
57 
58   void GetStatus(Stream &strm) override;
59 
60   Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
61                         FileSpec &local_file) override;
62 
63   bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
64 
65   uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
66                          ProcessInstanceInfoList &process_infos) override;
67 
68   bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
69 
70   int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override;
71 
72   bool CanDebugProcess() override;
73 
74   lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
75                                Debugger &debugger, Target *target,
76                                Error &error) override;
77 
78   void CalculateTrapHandlerSymbolNames() override;
79 
80   uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
81                                       unsigned flags) override;
82 
83   ConstString GetFullNameForDylib(ConstString basename) override;
84 
85 private:
86   DISALLOW_COPY_AND_ASSIGN(PlatformLinux);
87 };
88 
89 } // namespace platform_linux
90 } // namespace lldb_private
91 
92 #endif // liblldb_PlatformLinux_h_
93