[all-commits] [llvm/llvm-project] 4a924c: [lldb] Fix reading global variables on WebAssembly...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Fri Jun 26 08:53:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a924c0b839a5019b4ff7356fd732c2dbcd12fd2
      https://github.com/llvm/llvm-project/commit/4a924c0b839a5019b4ff7356fd732c2dbcd12fd2
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2026-06-26 (Fri, 26 Jun 2026)

  Changed paths:
    M lldb/source/Expression/DWARFExpression.cpp
    M lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    A lldb/test/Shell/ObjectFile/wasm/wasm-data-section-load-address.yaml
    M lldb/unittests/Expression/DWARFExpressionTest.cpp
    M llvm/docs/ReleaseNotes.md

  Log Message:
  -----------
  [lldb] Fix reading global variables on WebAssembly (#205913)

Reading a global or static variable on a Wasm target produced a wrong
value (or none at all). Two Wasm-only bugs combined to break it, both of
which need to be fixed to support `target variable` / `frame var`.

1. DWARFExpression::Evaluate special-cased DW_OP_addr and
DW_OP_addrx/DW_OP_GNU_addr_index on Wasm to push a LoadAddress, based on
the theory that "Wasm file sections aren't mapped into memory". But a
DW_OP_addr operand denotes a location in the module's address space,
i.e. a file address like on every other target. Forcing a load address
breaks the static (no-process) read path, since a file section cannot be
read as a load address.

2. ObjectFileWasm::SetLoadAddress mapped every section with
`load_address | GetFileOffset()`. For an active data segment that
Object-tags the address (top bit = code space) and uses the file offset
instead of the segment's linear-memory address, so a live read of a data
global resolved to a garbage address in the wrong space.

Address (1) by dropping the incorrect special casing. Address (2) by
mapping data sections into the Memory space at their linear VM address
while preserving the module id. Code and other sections keep their
Object-space module-offset addressing.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list