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   const char *GetDescription() override {
51     return GetPluginDescriptionStatic(IsHost());
52   }
53 
54   void GetStatus(Stream &strm) override;
55 
56   Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
57                         FileSpec &local_file) override;
58 
59   bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
60 
61   uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
62                          ProcessInstanceInfoList &process_infos) override;
63 
64   bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
65 
66   int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override;
67 
68   bool CanDebugProcess() override;
69 
70   lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
71                                Debugger &debugger, Target *target,
72                                Error &error) override;
73 
74   void CalculateTrapHandlerSymbolNames() override;
75 
76   uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
77                                       unsigned flags) override;
78 
79   ConstString GetFullNameForDylib(ConstString basename) override;
80 
81 private:
82   DISALLOW_COPY_AND_ASSIGN(PlatformLinux);
83 };
84 
85 } // namespace platform_linux
86 } // namespace lldb_private
87 
88 #endif // liblldb_PlatformLinux_h_
89