CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
101 lines
3.1 KiB
C++
101 lines
3.1 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "SymbolFileWasm.h"
|
|
#include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
|
|
#include "Utility/WasmVirtualRegisters.h"
|
|
#include "lldb/Utility/LLDBLog.h"
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
using namespace lldb_private::plugin::dwarf;
|
|
|
|
SymbolFileWasm::SymbolFileWasm(ObjectFileSP objfile_sp,
|
|
SectionList *dwo_section_list)
|
|
: SymbolFileDWARF(objfile_sp, dwo_section_list) {}
|
|
|
|
SymbolFileWasm::~SymbolFileWasm() = default;
|
|
|
|
lldb::offset_t
|
|
SymbolFileWasm::GetVendorDWARFOpcodeSize(const DataExtractor &data,
|
|
const lldb::offset_t data_offset,
|
|
const uint8_t op) const {
|
|
if (op != llvm::dwarf::DW_OP_WASM_location)
|
|
return LLDB_INVALID_OFFSET;
|
|
|
|
lldb::offset_t offset = data_offset;
|
|
const uint8_t wasm_op = data.GetU8(&offset);
|
|
switch (wasm_op) {
|
|
case 0: // LOCAL
|
|
case 1: // GLOBAL_FIXED
|
|
case 2: // OPERAND_STACK
|
|
data.GetULEB128(&offset);
|
|
break;
|
|
case 3: // GLOBAL_RELOC
|
|
data.GetU32(&offset);
|
|
break;
|
|
default:
|
|
return LLDB_INVALID_OFFSET;
|
|
}
|
|
|
|
return offset - data_offset;
|
|
}
|
|
|
|
bool SymbolFileWasm::ParseVendorDWARFOpcode(uint8_t op,
|
|
const llvm::DataExtractor &opcodes,
|
|
lldb::offset_t &offset,
|
|
RegisterContext *reg_ctx,
|
|
lldb::RegisterKind reg_kind,
|
|
std::vector<Value> &stack) const {
|
|
if (op != llvm::dwarf::DW_OP_WASM_location)
|
|
return false;
|
|
|
|
uint32_t index = 0;
|
|
uint8_t tag = eWasmTagNotAWasmLocation;
|
|
|
|
/// |DWARF Location Index | WebAssembly Construct |
|
|
/// |---------------------|-----------------------|
|
|
/// |0 | Local |
|
|
/// |1 or 3 | Global |
|
|
/// |2 | Operand Stack |
|
|
const uint8_t wasm_op = opcodes.getU8(&offset);
|
|
switch (wasm_op) {
|
|
case 0: // LOCAL
|
|
index = opcodes.getULEB128(&offset);
|
|
tag = eWasmTagLocal;
|
|
break;
|
|
case 1: // GLOBAL_FIXED
|
|
index = opcodes.getULEB128(&offset);
|
|
tag = eWasmTagGlobal;
|
|
break;
|
|
case 2: // OPERAND_STACK
|
|
index = opcodes.getULEB128(&offset);
|
|
tag = eWasmTagOperandStack;
|
|
break;
|
|
case 3: // GLOBAL_RELOC
|
|
index = opcodes.getU32(&offset);
|
|
tag = eWasmTagGlobal;
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
|
|
const uint32_t reg_num = GetWasmRegister(tag, index);
|
|
|
|
Value tmp;
|
|
llvm::Error error = DWARFExpression::ReadRegisterValueAsScalar(
|
|
reg_ctx, reg_kind, reg_num, tmp);
|
|
if (error) {
|
|
LLDB_LOG_ERROR(GetLog(DWARFLog::DebugInfo), std::move(error), "{0}");
|
|
return false;
|
|
}
|
|
|
|
stack.push_back(tmp);
|
|
return true;
|
|
}
|