xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
14824e7fdSDimitry Andric //===-- PlatformQemuUser.h ------------------------------------------------===//
24824e7fdSDimitry Andric //
34824e7fdSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44824e7fdSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
54824e7fdSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
64824e7fdSDimitry Andric //
74824e7fdSDimitry Andric //===----------------------------------------------------------------------===//
84824e7fdSDimitry Andric 
9*bdd1243dSDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
10*bdd1243dSDimitry Andric #define LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
11*bdd1243dSDimitry Andric 
124824e7fdSDimitry Andric #include "lldb/Host/Host.h"
134824e7fdSDimitry Andric #include "lldb/Host/HostInfo.h"
144824e7fdSDimitry Andric #include "lldb/Target/Platform.h"
154824e7fdSDimitry Andric 
164824e7fdSDimitry Andric namespace lldb_private {
174824e7fdSDimitry Andric 
184824e7fdSDimitry Andric class PlatformQemuUser : public Platform {
194824e7fdSDimitry Andric public:
204824e7fdSDimitry Andric   static void Initialize();
214824e7fdSDimitry Andric   static void Terminate();
224824e7fdSDimitry Andric 
GetPluginNameStatic()234824e7fdSDimitry Andric   static llvm::StringRef GetPluginNameStatic() { return "qemu-user"; }
244824e7fdSDimitry Andric   static llvm::StringRef GetPluginDescriptionStatic();
254824e7fdSDimitry Andric 
GetPluginName()264824e7fdSDimitry Andric   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
GetDescription()274824e7fdSDimitry Andric   llvm::StringRef GetDescription() override {
284824e7fdSDimitry Andric     return GetPluginDescriptionStatic();
294824e7fdSDimitry Andric   }
304824e7fdSDimitry Andric 
GetUserIDResolver()314824e7fdSDimitry Andric   UserIDResolver &GetUserIDResolver() override {
324824e7fdSDimitry Andric     return HostInfo::GetUserIDResolver();
334824e7fdSDimitry Andric   }
344824e7fdSDimitry Andric 
3581ad6265SDimitry Andric   std::vector<ArchSpec>
3681ad6265SDimitry Andric   GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
374824e7fdSDimitry Andric 
384824e7fdSDimitry Andric   lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
394824e7fdSDimitry Andric                                Debugger &debugger, Target &target,
404824e7fdSDimitry Andric                                Status &error) override;
414824e7fdSDimitry Andric 
Attach(ProcessAttachInfo & attach_info,Debugger & debugger,Target * target,Status & status)424824e7fdSDimitry Andric   lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
434824e7fdSDimitry Andric                          Target *target, Status &status) override {
444824e7fdSDimitry Andric     status.SetErrorString("Not supported");
454824e7fdSDimitry Andric     return nullptr;
464824e7fdSDimitry Andric   }
474824e7fdSDimitry Andric 
FindProcesses(const ProcessInstanceInfoMatch & match_info,ProcessInstanceInfoList & proc_infos)48*bdd1243dSDimitry Andric   uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
49*bdd1243dSDimitry Andric                          ProcessInstanceInfoList &proc_infos) override {
50*bdd1243dSDimitry Andric     return 0;
51*bdd1243dSDimitry Andric   }
52*bdd1243dSDimitry Andric 
GetProcessInfo(lldb::pid_t pid,ProcessInstanceInfo & proc_info)53*bdd1243dSDimitry Andric   bool GetProcessInfo(lldb::pid_t pid,
54*bdd1243dSDimitry Andric                       ProcessInstanceInfo &proc_info) override {
55*bdd1243dSDimitry Andric     return false;
56*bdd1243dSDimitry Andric   }
57*bdd1243dSDimitry Andric 
IsConnected()584824e7fdSDimitry Andric   bool IsConnected() const override { return true; }
594824e7fdSDimitry Andric 
CalculateTrapHandlerSymbolNames()604824e7fdSDimitry Andric   void CalculateTrapHandlerSymbolNames() override {}
614824e7fdSDimitry Andric 
620eae32dcSDimitry Andric   Environment GetEnvironment() override;
634824e7fdSDimitry Andric 
GetMmapArgumentList(const ArchSpec & arch,lldb::addr_t addr,lldb::addr_t length,unsigned prot,unsigned flags,lldb::addr_t fd,lldb::addr_t offset)6404eeddc0SDimitry Andric   MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
6504eeddc0SDimitry Andric                                   lldb::addr_t length, unsigned prot,
6604eeddc0SDimitry Andric                                   unsigned flags, lldb::addr_t fd,
6704eeddc0SDimitry Andric                                   lldb::addr_t offset) override {
6804eeddc0SDimitry Andric     return Platform::GetHostPlatform()->GetMmapArgumentList(
6904eeddc0SDimitry Andric         arch, addr, length, prot, flags, fd, offset);
7004eeddc0SDimitry Andric   }
7104eeddc0SDimitry Andric 
724824e7fdSDimitry Andric private:
734824e7fdSDimitry Andric   static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
744824e7fdSDimitry Andric   static void DebuggerInitialize(Debugger &debugger);
754824e7fdSDimitry Andric 
PlatformQemuUser()7681ad6265SDimitry Andric   PlatformQemuUser() : Platform(/*is_host=*/true) {}
774824e7fdSDimitry Andric };
784824e7fdSDimitry Andric 
794824e7fdSDimitry Andric } // namespace lldb_private
80*bdd1243dSDimitry Andric 
81*bdd1243dSDimitry Andric #endif // LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
82