[llvm] [llvm-debuginfo-analyzer] Add support for WebAssembly binary format. (PR #82588)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 10:33:14 PST 2024
================
@@ -0,0 +1,241 @@
+--- !WASM
+FileHeader:
+ Version: 0x1
+Sections:
+ - Type: TYPE
+ Signatures:
+ - Index: 0
+ ParamTypes:
+ - F32
+ ReturnTypes:
+ - I32
+ - Index: 1
+ ParamTypes:
+ - I32
+ ReturnTypes:
+ - I32
+ - Type: IMPORT
+ Imports:
+ - Module: env
+ Field: __linear_memory
+ Kind: MEMORY
+ Memory:
+ Minimum: 0x0
+ - Module: env
+ Field: __stack_pointer
+ Kind: GLOBAL
+ GlobalType: I32
+ GlobalMutable: true
+ - Type: FUNCTION
+ FunctionTypes: [ 0, 1 ]
+ - Type: CODE
+ Relocations:
+ - Type: R_WASM_GLOBAL_INDEX_LEB
+ Index: 1
+ Offset: 0xA
+ - Type: R_WASM_GLOBAL_INDEX_LEB
+ Index: 1
+ Offset: 0x75
+ - Type: R_WASM_GLOBAL_INDEX_LEB
+ Index: 1
+ Offset: 0x8A
+ - Type: R_WASM_FUNCTION_INDEX_LEB
+ Index: 0
+ Offset: 0xF3
+ - Type: R_WASM_GLOBAL_INDEX_LEB
+ Index: 1
+ Offset: 0x136
+ Functions:
+ - Index: 0
+ Locals:
+ - Type: I32
+ Count: 3
+ - Type: F32
+ Count: 3
+ - Type: I32
+ Count: 6
+ Body: 238080808000210141102102200120026B21032003200038020C20032A020C210420048B2105430000004F2106200520065D210720074521080240024020080D002004A821092009210A0C010B418080808078210B200B210A0B200A210C200C0F0B
+ - Index: 1
+ Locals:
+ - Type: I32
+ Count: 13
+ - Type: F32
+ Count: 2
+ - Type: I32
+ Count: 9
+ Body: 238080808000210141102102200120026B21032003248080808000200320003A000F20032D000F2104411821052004200574210620062005752107200320073602082003280208210820032D000F21094118210A2009200A74210B200B200A75210C2008200C6A210D200DB2210E2003200E38020420032A0204210F200F1080808080002110200320103602082003280208211120032D000F2112411821132012201374211420142013752115201120156A211641102117200320176A2118201824808080800020160F0B
+ - Type: CUSTOM
+ Name: .debug_abbrev
+ Payload: 011101250E1305030E10171B0E110155170000022400030E3E0B0B0B0000032E011101120640186E0E030E3A0B3B0B49133F1900000405000218030E3A0B3B0B491300000534000218030E3A0B3B0B49130000060B011101120600000716004913030E3A0B3B0B000000
+ - Type: CUSTOM
+ Relocations:
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 3
+ Offset: 0x6
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xC
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x12
+ Addend: 111
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 6
+ Offset: 0x16
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x1A
+ Addend: 124
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 4
+ Offset: 0x22
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x27
+ Addend: 178
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 0
+ Offset: 0x2E
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x3B
+ Addend: 182
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x3F
+ Addend: 190
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x4D
+ Addend: 219
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 2
+ Offset: 0x59
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x66
+ Addend: 194
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x6A
+ Addend: 202
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x78
+ Addend: 231
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x86
+ Addend: 242
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 2
+ Offset: 0x91
+ Addend: 73
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0x9D
+ Addend: 252
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xAD
+ Addend: 248
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xB8
+ Addend: 258
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xC0
+ Addend: 206
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xC7
+ Addend: 225
+ - Type: R_WASM_SECTION_OFFSET_I32
+ Index: 5
+ Offset: 0xCE
+ Addend: 237
+ Name: .debug_info
+ Payload: D100000004000000000004010000000021006F000000000000007C000000000000000000000002B2000000050403020000006900000004ED00039FB6000000BE0000000101260000000402910CDB0000000101C600000000036D000000D200000004ED00039FC2000000CA0000000103BF0000000402910FE70000000103CD00000005029108F20000000105A800000006B60000004B00000005029104FC0000000109B3000000000726000000F8000000010407C60000000201000001070002CE000000070402E1000000040402ED000000060100
+ - Type: CUSTOM
+ Relocations:
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 0
+ Offset: 0x0
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 0
+ Offset: 0x4
+ Addend: 105
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 2
+ Offset: 0x8
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 2
+ Offset: 0xC
+ Addend: 210
+ Name: .debug_ranges
+ Payload: 020000006B0000006D0000003F0100000000000000000000
+ - Type: CUSTOM
+ Name: .debug_str
+ Payload: 636C616E672076657273696F6E2031392E302E3067697420282F646174612F70726F6A656374732F6C6C766D2D726F6F742F6C6C766D2D70726F6A6563742F636C616E672032646236373033663063323537643239336466343535653264666638633166623639356334313030290070722D34343838342E637070002F646174612F70726F6A656374732F736372697074732F72656772657373696F6E2D73756974652F696E7075742F67656E6572616C00696E74005F5A336261726600626172005F5A33666F6F6300666F6F00756E7369676E656420696E7400496E70757400666C6F617400506172616D00636861720056616C756500494E5400416464656400464C4F415400
+ - Type: CUSTOM
+ Relocations:
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 0
+ Offset: 0x31
+ - Type: R_WASM_FUNCTION_OFFSET_I32
+ Index: 2
+ Offset: 0x4D
+ Name: .debug_line
+ Payload: 8A000000040024000000010101FB0E0D0001010101000000010000010070722D34343838342E6370700000000000000502020000000105240A08F20602321121B92105184A02040001010005026D00000014050F0A022914050706088205150678051D0674051B0882051574050D5805130675050F0674050D9E050A067705120674051008820503740217000101
+ - Type: CUSTOM
+ Name: linking
+ Version: 2
+ SymbolTable:
+ - Index: 0
+ Kind: FUNCTION
+ Name: _Z3barf
+ Flags: [ VISIBILITY_HIDDEN ]
+ Function: 0
+ - Index: 1
+ Kind: GLOBAL
+ Name: __stack_pointer
+ Flags: [ UNDEFINED ]
+ Global: 0
+ - Index: 2
+ Kind: FUNCTION
+ Name: _Z3fooc
+ Flags: [ VISIBILITY_HIDDEN ]
+ Function: 1
+ - Index: 3
+ Kind: SECTION
+ Flags: [ BINDING_LOCAL ]
+ Section: 4
+ - Index: 4
+ Kind: SECTION
+ Flags: [ BINDING_LOCAL ]
+ Section: 6
+ - Index: 5
+ Kind: SECTION
+ Flags: [ BINDING_LOCAL ]
+ Section: 7
+ - Index: 6
+ Kind: SECTION
+ Flags: [ BINDING_LOCAL ]
+ Section: 8
+ - Type: CUSTOM
+ Name: producers
+ Languages:
+ - Name: C_plus_plus_14
+ Version: ''
+ Tools:
+ - Name: clang
+ Version: '19.0.0git (/data/projects/llvm-root/llvm-project/clang 2db6703f0c257d293df455e2dff8c1fb695c4100)'
+ - Type: CUSTOM
+ Name: target_features
+ Features:
+ - Prefix: USED
+ Name: mutable-globals
+ - Prefix: USED
+ Name: sign-ext
+...
----------------
sbc100 wrote:
Its really up to you, but I think the the .s format might be readable and editable here. But it if you are always planning on using the `.cpp` as the source of truth I guess it doesn't matter so much?
I guess maybe using the `.s` format means depending on a little more of llvm?
If the .cpp files *are* the source of truth here perhaps include a readme/script for how to regenerate the yaml files?
https://github.com/llvm/llvm-project/pull/82588
More information about the llvm-commits
mailing list