[Lldb-commits] [lldb] 9c3c94f - [lldb] Record the value type and mutability of Wasm globals (#236586)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 29 06:18:53 PDT 2026
Author: Felipe de Azevedo Piovezan
Date: 2026-10-29T13:18:47Z
New Revision: 9c3c94f04c1ee241dde6c21867acbf0ccb035106
URL: https://github.com/llvm/llvm-project/commit/9c3c94f04c1ee241dde6c21867acbf0ccb035106
DIFF: https://github.com/llvm/llvm-project/commit/9c3c94f04c1ee241dde6c21867acbf0ccb035106.diff
LOG: [lldb] Record the value type and mutability of Wasm globals (#236586)
ParseGlobals read both and discarded them. Keep them in WasmGlobal, in
preparation for telling which exported globals hold the address of a
variable in linear memory.
Added:
Modified:
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
index a266464e49aabb..4b89e44a18d9da 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -620,8 +620,9 @@ ParseGlobals(DataExtractor &data) {
"global section holds %zu of its %u globals", globals.size(), *count);
WasmGlobal global;
- global.size = GetWasmValueTypeSize(data.GetU8(&offset));
- data.GetU8(&offset); // mutability
+ global.value_type = data.GetU8(&offset);
+ global.size = GetWasmValueTypeSize(global.value_type);
+ global.is_mutable = data.GetU8(&offset) != 0;
global.init_expr_value = ParseGlobalInitValue(data, offset);
globals.push_back(global);
}
diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
index 22472f3ad2008e..cdfe6e41bab84d 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -20,6 +20,9 @@ namespace wasm {
/// A global declared by the module itself. Imported globals occupy the low
/// indices of the same index space and have no entry here.
struct WasmGlobal {
+ uint8_t value_type = 0;
+ bool is_mutable = false;
+
/// Size of the global's value type, which bounds what a read can produce.
/// Absent for a value type whose values cannot be read.
std::optional<uint32_t> size;
More information about the lldb-commits
mailing list