LLDB mainline
PlatformQemuUser.h
Go to the documentation of this file.
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"
15
16namespace lldb_private {
17
18class PlatformQemuUser : public Platform {
19public:
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 {
29 }
30
32 return HostInfo::GetUserIDResolver();
33 }
34
35 std::vector<ArchSpec>
36 GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
37
39 Debugger &debugger, Target &target,
40 Status &error) override;
41
43 Target *target, Status &status) override {
44 status.SetErrorString("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
54 ProcessInstanceInfo &proc_info) override {
55 return false;
56 }
57
58 bool IsConnected() const override { return true; }
59
61
62 Environment GetEnvironment() override;
63
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
72private:
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
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
A class to manage flag bits.
Definition: Debugger.h:79
MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, lldb::addr_t length, unsigned prot, unsigned flags, lldb::addr_t fd, lldb::addr_t offset) override
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) override
Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed b...
uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos) override
Attach to an existing process by process name.
llvm::StringRef GetDescription() override
static llvm::StringRef GetPluginDescriptionStatic()
static llvm::StringRef GetPluginNameStatic()
Environment GetEnvironment() override
llvm::StringRef GetPluginName() override
bool IsConnected() const override
static void DebuggerInitialize(Debugger &debugger)
UserIDResolver & GetUserIDResolver() override
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override
lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Status &status) override
Attach to an existing process using a process ID.
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch)
void CalculateTrapHandlerSymbolNames() override
Ask the Platform subclass to fill in the list of trap handler names.
std::vector< ArchSpec > GetSupportedArchitectures(const ArchSpec &process_host_arch) override
Get the platform's supported architectures in the order in which they should be searched.
A plug-in interface definition class for debug platform that includes many platform abilities such as...
Definition: Platform.h:74
static lldb::PlatformSP GetHostPlatform()
Get the native host platform plug-in.
Definition: Platform.cpp:134
An error handling class.
Definition: Status.h:44
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:233
An abstract interface for things that know how to map numeric user/group IDs into names.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
llvm::SmallVector< lldb::addr_t, 6 > MmapArgList
Definition: Platform.h:61
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:32
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:380
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
uint64_t pid_t
Definition: lldb-types.h:81
uint64_t addr_t
Definition: lldb-types.h:79