| # REQUIRES: webassembly | |
| # Embedded data formatters are placed by a `section` attribute on a data | |
| # variable, which on wasm lands in a named data segment rather than a top-level | |
| # custom section. Recognize the well-known formatter segment names so the | |
| # data-formatter loader can find them, and map the segments into linear memory | |
| # like any other data segment. | |
| # RUN: yaml2obj %s -o %t.wasm | |
| # RUN: %lldb %t.wasm \ | |
| # RUN: -o "target modules dump sections" \ | |
| # RUN: -o "target modules load --file %t.wasm --slide 0x4000000000000000" \ | |
| # RUN: -o "target modules dump sections" \ | |
| # RUN: -o exit 2>&1 | FileCheck %s | |
| # The formatter segments are typed as formatter sections, not plain data, and | |
| # their file address is their linear-memory address (from the init expr). | |
| # CHECK-LABEL: File Address | |
| # CHECK-DAG: lldb-formatters {{.*}}[0x0000000000010000-0x0000000000010004) | |
| # CHECK-DAG: lldb-type-summaries {{.*}}[0x0000000000010010-0x0000000000010014) | |
| # After loading the module in the Object space (top bit set), the formatter | |
| # segments stay in the Memory space at their linear address like other data. | |
| # CHECK-LABEL: Load Address | |
| # CHECK-DAG: lldb-formatters {{.*}}[0x0000000000010000-0x0000000000010004) | |
| # CHECK-DAG: lldb-type-summaries {{.*}}[0x0000000000010010-0x0000000000010014) | |
| --- !WASM | |
| FileHeader: | |
| Version: 0x1 | |
| Sections: | |
| - Type: TYPE | |
| Signatures: | |
| - Index: 0 | |
| ParamTypes: [] | |
| ReturnTypes: | |
| - I32 | |
| - Type: FUNCTION | |
| FunctionTypes: [ 0 ] | |
| - Type: MEMORY | |
| Memories: | |
| - Minimum: 0x2 | |
| - Type: CODE | |
| Functions: | |
| - Index: 0 | |
| Locals: [] | |
| Body: 412A0F0B | |
| - Type: DATA | |
| Segments: | |
| - SectionOffset: 6 | |
| InitFlags: 0 | |
| Offset: | |
| Opcode: I32_CONST | |
| Value: 65536 | |
| Content: 'DEADBEEF' | |
| - SectionOffset: 16 | |
| InitFlags: 0 | |
| Offset: | |
| Opcode: I32_CONST | |
| Value: 65552 | |
| Content: 'CAFEBABE' | |
| - Type: CUSTOM | |
| Name: name | |
| FunctionNames: | |
| - Index: 0 | |
| Name: get_42 | |
| DataSegmentNames: | |
| - Index: 0 | |
| Name: .lldbformatters | |
| - Index: 1 | |
| Name: .lldbsummaries | |
| ... |