This PR makes `PlatformWasm` a `RemoteAwarePlatform` that can connect to a remote GDB platform server. `PlatformWasmRemoteGDBServer` inherits from `PlatformRemoteGDBServer`, with the only difference that it picks the correct Process plugin when launching and attaching. The approach is identical to the one taken by `PlatformAndroid`. The context is that we're working on a platform based approach for discovering and attaching Wasm processes running under JSC with the [newly added debugging support](https://github.com/WebKit/WebKit/pull/51462).
68 lines
2.3 KiB
C++
68 lines
2.3 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_WASM_PLATFORMWASM_H
|
|
#define LLDB_SOURCE_PLUGINS_PLATFORM_WASM_PLATFORMWASM_H
|
|
|
|
#include "lldb/Host/Host.h"
|
|
#include "lldb/Host/HostInfo.h"
|
|
#include "lldb/Target/Platform.h"
|
|
#include "lldb/Target/RemoteAwarePlatform.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
class PlatformWasm : public RemoteAwarePlatform {
|
|
public:
|
|
static void Initialize();
|
|
static void Terminate();
|
|
|
|
static llvm::StringRef GetPluginNameStatic() { return "wasm"; }
|
|
static llvm::StringRef GetPluginDescriptionStatic();
|
|
|
|
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
|
llvm::StringRef GetDescription() override {
|
|
return GetPluginDescriptionStatic();
|
|
}
|
|
|
|
UserIDResolver &GetUserIDResolver() override {
|
|
return HostInfo::GetUserIDResolver();
|
|
}
|
|
|
|
std::vector<ArchSpec>
|
|
GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
|
|
|
|
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
|
|
Debugger &debugger, Target &target,
|
|
Status &error) override;
|
|
|
|
lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
|
|
Target *target, Status &status) override;
|
|
|
|
Status ConnectRemote(Args &args) override;
|
|
|
|
void CalculateTrapHandlerSymbolNames() override {}
|
|
|
|
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 {
|
|
return Platform::GetHostPlatform()->GetMmapArgumentList(
|
|
arch, addr, length, prot, flags, fd, offset);
|
|
}
|
|
|
|
private:
|
|
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
|
static void DebuggerInitialize(Debugger &debugger);
|
|
|
|
PlatformWasm() : RemoteAwarePlatform(/*is_host=*/false) {}
|
|
};
|
|
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_SOURCE_PLUGINS_PLATFORM_WASM_PLATFORMWASM_H
|