1 | //===-- PlatformPOSIX.h -----------------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H |
10 | #define LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H |
11 | |
12 | #include <map> |
13 | #include <memory> |
14 | |
15 | #include "lldb/Interpreter/Options.h" |
16 | #include "lldb/Target/RemoteAwarePlatform.h" |
17 | |
18 | class PlatformPOSIX : public lldb_private::RemoteAwarePlatform { |
19 | public: |
20 | PlatformPOSIX(bool is_host); |
21 | |
22 | ~PlatformPOSIX() override; |
23 | |
24 | // lldb_private::Platform functions |
25 | |
26 | lldb_private::OptionGroupOptions * |
27 | GetConnectionOptions(lldb_private::CommandInterpreter &interpreter) override; |
28 | |
29 | lldb_private::Status PutFile(const lldb_private::FileSpec &source, |
30 | const lldb_private::FileSpec &destination, |
31 | uint32_t uid = UINT32_MAX, |
32 | uint32_t gid = UINT32_MAX) override; |
33 | |
34 | lldb_private::Status |
35 | GetFile(const lldb_private::FileSpec &source, |
36 | const lldb_private::FileSpec &destination) override; |
37 | |
38 | const lldb::UnixSignalsSP &GetRemoteUnixSignals() override; |
39 | |
40 | lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info, |
41 | lldb_private::Debugger &debugger, |
42 | lldb_private::Target *target, // Can be nullptr, if |
43 | // nullptr create a new |
44 | // target, else use |
45 | // existing one |
46 | lldb_private::Status &error) override; |
47 | |
48 | lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, |
49 | lldb_private::Debugger &debugger, |
50 | lldb_private::Target &target, |
51 | lldb_private::Status &error) override; |
52 | |
53 | std::string GetPlatformSpecificConnectionInformation() override; |
54 | |
55 | void CalculateTrapHandlerSymbolNames() override; |
56 | |
57 | lldb_private::Status ConnectRemote(lldb_private::Args &args) override; |
58 | |
59 | lldb_private::Status DisconnectRemote() override; |
60 | |
61 | uint32_t DoLoadImage(lldb_private::Process *process, |
62 | const lldb_private::FileSpec &remote_file, |
63 | const std::vector<std::string> *paths, |
64 | lldb_private::Status &error, |
65 | lldb_private::FileSpec *loaded_image) override; |
66 | |
67 | lldb_private::Status UnloadImage(lldb_private::Process *process, |
68 | uint32_t image_token) override; |
69 | |
70 | lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override; |
71 | |
72 | protected: |
73 | std::unique_ptr<lldb_private::OptionGroupPlatformRSync> |
74 | m_option_group_platform_rsync; |
75 | std::unique_ptr<lldb_private::OptionGroupPlatformSSH> |
76 | m_option_group_platform_ssh; |
77 | std::unique_ptr<lldb_private::OptionGroupPlatformCaching> |
78 | m_option_group_platform_caching; |
79 | |
80 | std::map<lldb_private::CommandInterpreter *, |
81 | std::unique_ptr<lldb_private::OptionGroupOptions>> |
82 | m_options; |
83 | |
84 | lldb_private::Status |
85 | EvaluateLibdlExpression(lldb_private::Process *process, const char *expr_cstr, |
86 | llvm::StringRef expr_prefix, |
87 | lldb::ValueObjectSP &result_valobj_sp); |
88 | |
89 | std::unique_ptr<lldb_private::UtilityFunction> |
90 | MakeLoadImageUtilityFunction(lldb_private::ExecutionContext &exe_ctx, |
91 | lldb_private::Status &error); |
92 | |
93 | virtual |
94 | llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process); |
95 | |
96 | private: |
97 | PlatformPOSIX(const PlatformPOSIX &) = delete; |
98 | const PlatformPOSIX &operator=(const PlatformPOSIX &) = delete; |
99 | }; |
100 | |
101 | #endif // LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H |
102 | |