blob: 8951470f4c5b6de7a399f6d54ff5e478b0c8bf66 [file] [log] [blame]
## This test checks that DW_OP_addrx expression operand
## is correctly recognized and converted into the DW_OP_addr
## operand or just preserved in case --update.
## cat dwarf5-dw-op-addrx.c
## $ clang -gdwarf-5 dwarf5-dw-op-addrx.c -c -O2 -o dwarf5-dw-op-addrx.o
#RUN: dsymutil -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
#RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
#RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix DWARF-CHECK
#RUN: dsymutil --update -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
#RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
#RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix UPD-DWARF-CHECK
#CHECK: No errors.
#DWARF-CHECK: DW_TAG_compile_unit
#DWARF-CHECK: DW_AT_name {{.*}}"dwarf5-dw-op-addrx.c"
#DWARF-CHECK: DW_AT_low_pc {{.*}}0x0000000100000fb0
#DWARF-CHECK: DW_TAG_variable
#DWARF-CHECK: DW_AT_name {{.*}}"arr"
#DWARF-CHECK: DW_AT_location {{.*}}(DW_OP_addr 0x100002000)
#DWARF-CHECK-NOT: .debug_addr
#UPD-DWARF-CHECK: DW_TAG_compile_unit
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"dwarf5-dw-op-addrx.c"
#UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000000)
#UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000008)
#UPD-DWARF-CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
#UPD-DWARF-CHECK: DW_TAG_variable
#UPD-DWARF-CHECK: DW_AT_name {{.*}}"arr"
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0)
#UPD-DWARF-CHECK: .debug_addr contents:
#UPD-DWARF-CHECK: 0x00000000: Address table header: length = 0x00000014, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
#UPD-DWARF-CHECK: 0x0000000000000000
#UPD-DWARF-CHECK: 0x0000000000000000
---
triple: 'x86_64-apple-darwin'
objects:
- filename: 'dwarf5-dw-op-addrx.o'
timestamp: 1676048242
symbols:
- { sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000FB0, size: 0x00000008 }
- { sym: _arr, binAddr: 0x0000000100002000, size: 0x00000000 }