This PR implements a register context for Wasm, which uses virtual registers to resolve Wasm local, globals and stack values. The registers are used to implement support for `DW_OP_WASM_location` in the DWARF expression evaluator (#151010). This also adds a more comprehensive test, showing that we can use this to show local variables.
42 lines
1.3 KiB
C++
42 lines
1.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_PROCESS_WASM_THREADWASM_H
|
|
#define LLDB_SOURCE_PLUGINS_PROCESS_WASM_THREADWASM_H
|
|
|
|
#include "Plugins/Process/gdb-remote/ThreadGDBRemote.h"
|
|
|
|
namespace lldb_private {
|
|
namespace wasm {
|
|
|
|
/// ProcessWasm provides the access to the Wasm program state
|
|
/// retrieved from the Wasm engine.
|
|
class ThreadWasm : public process_gdb_remote::ThreadGDBRemote {
|
|
public:
|
|
ThreadWasm(Process &process, lldb::tid_t tid)
|
|
: process_gdb_remote::ThreadGDBRemote(process, tid) {}
|
|
~ThreadWasm() override = default;
|
|
|
|
/// Retrieve the current call stack from the WebAssembly remote process.
|
|
llvm::Expected<std::vector<lldb::addr_t>> GetWasmCallStack();
|
|
|
|
lldb::RegisterContextSP
|
|
CreateRegisterContextForFrame(StackFrame *frame) override;
|
|
|
|
protected:
|
|
Unwind &GetUnwinder() override;
|
|
|
|
ThreadWasm(const ThreadWasm &);
|
|
const ThreadWasm &operator=(const ThreadWasm &) = delete;
|
|
};
|
|
|
|
} // namespace wasm
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_SOURCE_PLUGINS_PROCESS_WASM_THREADWASM_H
|