| 1 | //===-- PlatformQemuUser.h ------------------------------------------------===// |
| 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_QEMUUSER_PLATFORMQEMUUSER_H |
| 10 | #define LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H |
| 11 | |
| 12 | #include "lldb/Host/Host.h" |
| 13 | #include "lldb/Host/HostInfo.h" |
| 14 | #include "lldb/Target/Platform.h" |
| 15 | |
| 16 | namespace lldb_private { |
| 17 | |
| 18 | class PlatformQemuUser : public Platform { |
| 19 | public: |
| 20 | static void Initialize(); |
| 21 | static void Terminate(); |
| 22 | |
| 23 | static llvm::StringRef GetPluginNameStatic() { return "qemu-user" ; } |
| 24 | static llvm::StringRef GetPluginDescriptionStatic(); |
| 25 | |
| 26 | llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } |
| 27 | llvm::StringRef GetDescription() override { |
| 28 | return GetPluginDescriptionStatic(); |
| 29 | } |
| 30 | |
| 31 | UserIDResolver &GetUserIDResolver() override { |
| 32 | return HostInfo::GetUserIDResolver(); |
| 33 | } |
| 34 | |
| 35 | std::vector<ArchSpec> |
| 36 | GetSupportedArchitectures(const ArchSpec &process_host_arch) override; |
| 37 | |
| 38 | lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, |
| 39 | Debugger &debugger, Target &target, |
| 40 | Status &error) override; |
| 41 | |
| 42 | lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, |
| 43 | Target *target, Status &status) override { |
| 44 | status = Status::FromErrorString(str: "Not supported" ); |
| 45 | return nullptr; |
| 46 | } |
| 47 | |
| 48 | uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, |
| 49 | ProcessInstanceInfoList &proc_infos) override { |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | bool GetProcessInfo(lldb::pid_t pid, |
| 54 | ProcessInstanceInfo &proc_info) override { |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | bool IsConnected() const override { return true; } |
| 59 | |
| 60 | void CalculateTrapHandlerSymbolNames() override {} |
| 61 | |
| 62 | Environment GetEnvironment() override; |
| 63 | |
| 64 | MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, |
| 65 | lldb::addr_t length, unsigned prot, |
| 66 | unsigned flags, lldb::addr_t fd, |
| 67 | lldb::addr_t offset) override { |
| 68 | return Platform::GetHostPlatform()->GetMmapArgumentList( |
| 69 | arch, addr, length, prot, flags, fd, offset); |
| 70 | } |
| 71 | |
| 72 | private: |
| 73 | static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); |
| 74 | static void DebuggerInitialize(Debugger &debugger); |
| 75 | |
| 76 | PlatformQemuUser() : Platform(/*is_host=*/true) {} |
| 77 | }; |
| 78 | |
| 79 | } // namespace lldb_private |
| 80 | |
| 81 | #endif // LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H |
| 82 | |