xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
10b57cec5SDimitry Andric //===-- PlatformPOSIX.h -----------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
95ffd83dbSDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
105ffd83dbSDimitry Andric #define LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include <map>
130b57cec5SDimitry Andric #include <memory>
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #include "lldb/Interpreter/Options.h"
160b57cec5SDimitry Andric #include "lldb/Target/RemoteAwarePlatform.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric class PlatformPOSIX : public lldb_private::RemoteAwarePlatform {
190b57cec5SDimitry Andric public:
200b57cec5SDimitry Andric   PlatformPOSIX(bool is_host);
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric   ~PlatformPOSIX() override;
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric   // lldb_private::Platform functions
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric   lldb_private::OptionGroupOptions *
270b57cec5SDimitry Andric   GetConnectionOptions(lldb_private::CommandInterpreter &interpreter) override;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric   lldb_private::Status PutFile(const lldb_private::FileSpec &source,
300b57cec5SDimitry Andric                                const lldb_private::FileSpec &destination,
310b57cec5SDimitry Andric                                uint32_t uid = UINT32_MAX,
320b57cec5SDimitry Andric                                uint32_t gid = UINT32_MAX) override;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric   lldb_private::Status
350b57cec5SDimitry Andric   GetFile(const lldb_private::FileSpec &source,
360b57cec5SDimitry Andric           const lldb_private::FileSpec &destination) override;
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric   const lldb::UnixSignalsSP &GetRemoteUnixSignals() override;
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric   lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info,
410b57cec5SDimitry Andric                          lldb_private::Debugger &debugger,
420b57cec5SDimitry Andric                          lldb_private::Target *target, // Can be nullptr, if
430b57cec5SDimitry Andric                                                        // nullptr create a new
440b57cec5SDimitry Andric                                                        // target, else use
450b57cec5SDimitry Andric                                                        // existing one
460b57cec5SDimitry Andric                          lldb_private::Status &error) override;
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric   lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info,
490b57cec5SDimitry Andric                                lldb_private::Debugger &debugger,
50*349cc55cSDimitry Andric                                lldb_private::Target &target,
510b57cec5SDimitry Andric                                lldb_private::Status &error) override;
520b57cec5SDimitry Andric 
530b57cec5SDimitry Andric   std::string GetPlatformSpecificConnectionInformation() override;
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric   void CalculateTrapHandlerSymbolNames() override;
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric   lldb_private::Status ConnectRemote(lldb_private::Args &args) override;
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric   lldb_private::Status DisconnectRemote() override;
600b57cec5SDimitry Andric 
610b57cec5SDimitry Andric   uint32_t DoLoadImage(lldb_private::Process *process,
620b57cec5SDimitry Andric                        const lldb_private::FileSpec &remote_file,
630b57cec5SDimitry Andric                        const std::vector<std::string> *paths,
640b57cec5SDimitry Andric                        lldb_private::Status &error,
650b57cec5SDimitry Andric                        lldb_private::FileSpec *loaded_image) override;
660b57cec5SDimitry Andric 
670b57cec5SDimitry Andric   lldb_private::Status UnloadImage(lldb_private::Process *process,
680b57cec5SDimitry Andric                                    uint32_t image_token) override;
690b57cec5SDimitry Andric 
700b57cec5SDimitry Andric   lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override;
710b57cec5SDimitry Andric 
720b57cec5SDimitry Andric protected:
730b57cec5SDimitry Andric   std::unique_ptr<lldb_private::OptionGroupPlatformRSync>
740b57cec5SDimitry Andric       m_option_group_platform_rsync;
750b57cec5SDimitry Andric   std::unique_ptr<lldb_private::OptionGroupPlatformSSH>
760b57cec5SDimitry Andric       m_option_group_platform_ssh;
770b57cec5SDimitry Andric   std::unique_ptr<lldb_private::OptionGroupPlatformCaching>
780b57cec5SDimitry Andric       m_option_group_platform_caching;
790b57cec5SDimitry Andric 
800b57cec5SDimitry Andric   std::map<lldb_private::CommandInterpreter *,
810b57cec5SDimitry Andric            std::unique_ptr<lldb_private::OptionGroupOptions>>
820b57cec5SDimitry Andric       m_options;
830b57cec5SDimitry Andric 
840b57cec5SDimitry Andric   lldb_private::Status
850b57cec5SDimitry Andric   EvaluateLibdlExpression(lldb_private::Process *process, const char *expr_cstr,
860b57cec5SDimitry Andric                           llvm::StringRef expr_prefix,
870b57cec5SDimitry Andric                           lldb::ValueObjectSP &result_valobj_sp);
880b57cec5SDimitry Andric 
890b57cec5SDimitry Andric   std::unique_ptr<lldb_private::UtilityFunction>
900b57cec5SDimitry Andric   MakeLoadImageUtilityFunction(lldb_private::ExecutionContext &exe_ctx,
910b57cec5SDimitry Andric                                lldb_private::Status &error);
920b57cec5SDimitry Andric 
930b57cec5SDimitry Andric   virtual
940b57cec5SDimitry Andric   llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process);
950b57cec5SDimitry Andric 
960b57cec5SDimitry Andric private:
975ffd83dbSDimitry Andric   PlatformPOSIX(const PlatformPOSIX &) = delete;
985ffd83dbSDimitry Andric   const PlatformPOSIX &operator=(const PlatformPOSIX &) = delete;
990b57cec5SDimitry Andric };
1000b57cec5SDimitry Andric 
1015ffd83dbSDimitry Andric #endif // LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
102