[llvm] [llvm-debuginfo-analyzer] Add support for WebAssembly binary format. (PR #82588)
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 02:14:00 PDT 2024
================
@@ -122,6 +122,48 @@ class LVBinaryReader : public LVReader {
std::unique_ptr<MCContext> MC;
std::unique_ptr<MCInstPrinter> MIP;
+ // https://yurydelendik.github.io/webassembly-dwarf/
+ // 2. Consuming and Generating DWARF for WebAssembly Code
+ // Note: Some DWARF constructs don't map one-to-one onto WebAssembly
+ // constructs. We strive to enumerate and resolve any ambiguities here.
+ //
+ // 2.1. Code Addresses
+ // Note: DWARF associates various bits of debug info
+ // with particular locations in the program via its code address (instruction
+ // pointer or PC). However, WebAssembly's linear memory address space does not
+ // contain WebAssembly instructions.
+ //
+ // Wherever a code address (see 2.17 of [DWARF]) is used in DWARF for
+ // WebAssembly, it must be the offset of an instruction relative within the
+ // Code section of the WebAssembly file. The DWARF is considered malformed if
+ // a PC offset is between instruction boundaries within the Code section.
+ //
+ // Note: It is expected that a DWARF consumer does not know how to decode
+ // WebAssembly instructions. The instruction pointer is selected as the offset
+ // in the binary file of the first byte of the instruction, and it is
+ // consistent with the WebAssembly Web API conventions definition of the code
+ // location.
+ //
+ // EXAMPLE: .DEBUG_LINE INSTRUCTION POINTERS
+ // The .debug_line DWARF section maps instruction pointers to source
+ // locations. With WebAssembly, the .debug_line section maps Code
+ // section-relative instruction offsets to source locations.
+ //
+ // EXAMPLE: DW_AT_* ATTRIBUTES
----------------
CarlosAlbertoEnciso wrote:
Removed the extra whitespace.
https://github.com/llvm/llvm-project/pull/82588
More information about the llvm-commits
mailing list