1 //===-- PlatformQemuUser.h ------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
12 #include "lldb/Host/Host.h"
13 #include "lldb/Host/HostInfo.h"
14 #include "lldb/Target/Platform.h"
16 namespace lldb_private
{
18 class PlatformQemuUser
: public Platform
{
20 static void Initialize();
21 static void Terminate();
23 static llvm::StringRef
GetPluginNameStatic() { return "qemu-user"; }
24 static llvm::StringRef
GetPluginDescriptionStatic();
26 llvm::StringRef
GetPluginName() override
{ return GetPluginNameStatic(); }
27 llvm::StringRef
GetDescription() override
{
28 return GetPluginDescriptionStatic();
31 UserIDResolver
&GetUserIDResolver() override
{
32 return HostInfo::GetUserIDResolver();
36 GetSupportedArchitectures(const ArchSpec
&process_host_arch
) override
;
38 lldb::ProcessSP
DebugProcess(ProcessLaunchInfo
&launch_info
,
39 Debugger
&debugger
, Target
&target
,
40 Status
&error
) override
;
42 lldb::ProcessSP
Attach(ProcessAttachInfo
&attach_info
, Debugger
&debugger
,
43 Target
*target
, Status
&status
) override
{
44 status
.SetErrorString("Not supported");
48 uint32_t FindProcesses(const ProcessInstanceInfoMatch
&match_info
,
49 ProcessInstanceInfoList
&proc_infos
) override
{
53 bool GetProcessInfo(lldb::pid_t pid
,
54 ProcessInstanceInfo
&proc_info
) override
{
58 bool IsConnected() const override
{ return true; }
60 void CalculateTrapHandlerSymbolNames() override
{}
62 Environment
GetEnvironment() override
;
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
);
73 static lldb::PlatformSP
CreateInstance(bool force
, const ArchSpec
*arch
);
74 static void DebuggerInitialize(Debugger
&debugger
);
76 PlatformQemuUser() : Platform(/*is_host=*/true) {}
79 } // namespace lldb_private
81 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H