1# This test checks the handling of location lists in the case when the module is 2# not loaded at the address at which it was linked (as happens with ASLR for 3# instance). 4 5# RUN: yaml2obj %S/Inputs/debug_loc-aslr.yaml -o %t.dmp 6# RUN: llvm-mc --triple=x86_64-pc-linux --filetype=obj %s >%t.o 7# RUN: %lldb -c %t.dmp -o "image add %t.o" \ 8# RUN: -o "image load --file %t.o --slide 0x470000" \ 9# RUN: -o "thread info" -o "frame variable" -o exit | FileCheck %s 10 11# CHECK: thread #1: tid = 16001, 0x0000000000470001 {{.*}}`_start 12# CHECK: (int) x = 47 13# CHECK: (int) y = 74 14 15 .text 16 .globl _start 17_start: 18 nop 19 retq 20.Lstart_end: 21 22 .section .debug_loc,"",@progbits 23# This location list implicitly uses the base address of the compile unit. 24.Ldebug_loc0: 25 .quad _start-_start 26 .quad .Lstart_end-_start 27 .short 3 # Loc expr size 28 .byte 8 # DW_OP_const1u 29 .byte 47 30 .byte 159 # DW_OP_stack_value 31 .quad 0 32 .quad 0 33 34# This is an equivalent location list to the first one, but here the base 35# address is set explicitly. 36.Ldebug_loc1: 37 .quad -1 38 .quad _start 39 .quad _start-_start 40 .quad .Lstart_end-_start 41 .short 3 # Loc expr size 42 .byte 8 # DW_OP_const1u 43 .byte 74 44 .byte 159 # DW_OP_stack_value 45 .quad 0 46 .quad 0 47 48 .section .debug_abbrev,"",@progbits 49 .byte 1 # Abbreviation Code 50 .byte 17 # DW_TAG_compile_unit 51 .byte 1 # DW_CHILDREN_yes 52 .byte 37 # DW_AT_producer 53 .byte 8 # DW_FORM_string 54 .byte 19 # DW_AT_language 55 .byte 5 # DW_FORM_data2 56 .byte 17 # DW_AT_low_pc 57 .byte 1 # DW_FORM_addr 58 .byte 18 # DW_AT_high_pc 59 .byte 6 # DW_FORM_data4 60 .byte 0 # EOM(1) 61 .byte 0 # EOM(2) 62 .byte 2 # Abbreviation Code 63 .byte 46 # DW_TAG_subprogram 64 .byte 1 # DW_CHILDREN_yes 65 .byte 17 # DW_AT_low_pc 66 .byte 1 # DW_FORM_addr 67 .byte 18 # DW_AT_high_pc 68 .byte 6 # DW_FORM_data4 69 .byte 3 # DW_AT_name 70 .byte 8 # DW_FORM_string 71 .byte 0 # EOM(1) 72 .byte 0 # EOM(2) 73 .byte 4 # Abbreviation Code 74 .byte 52 # DW_TAG_variable 75 .byte 0 # DW_CHILDREN_no 76 .byte 2 # DW_AT_location 77 .byte 23 # DW_FORM_sec_offset 78 .byte 3 # DW_AT_name 79 .byte 8 # DW_FORM_string 80 .byte 73 # DW_AT_type 81 .byte 19 # DW_FORM_ref4 82 .byte 0 # EOM(1) 83 .byte 0 # EOM(2) 84 .byte 6 # Abbreviation Code 85 .byte 36 # DW_TAG_base_type 86 .byte 0 # DW_CHILDREN_no 87 .byte 3 # DW_AT_name 88 .byte 8 # DW_FORM_string 89 .byte 62 # DW_AT_encoding 90 .byte 11 # DW_FORM_data1 91 .byte 11 # DW_AT_byte_size 92 .byte 11 # DW_FORM_data1 93 .byte 0 # EOM(1) 94 .byte 0 # EOM(2) 95 .byte 0 # EOM(3) 96 .section .debug_info,"",@progbits 97.Lcu_begin0: 98 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 99.Ldebug_info_start0: 100 .short 4 # DWARF version number 101 .long .debug_abbrev # Offset Into Abbrev. Section 102 .byte 8 # Address Size (in bytes) 103 .byte 1 # Abbrev [1] 0xb:0x6a DW_TAG_compile_unit 104 .asciz "Hand-written DWARF" # DW_AT_producer 105 .short 12 # DW_AT_language 106 .quad _start # DW_AT_low_pc 107 .long .Lstart_end-_start # DW_AT_high_pc 108 .byte 2 # Abbrev [2] 0x2a:0x43 DW_TAG_subprogram 109 .quad _start # DW_AT_low_pc 110 .long .Lstart_end-_start # DW_AT_high_pc 111 .asciz "_start" # DW_AT_name 112 .byte 4 # Abbrev [4] 0x52:0xf DW_TAG_variable 113 .long .Ldebug_loc0 # DW_AT_location 114 .asciz "x" # DW_AT_name 115 .long .Lint # DW_AT_type 116 .byte 4 # Abbrev [4] 0x52:0xf DW_TAG_variable 117 .long .Ldebug_loc1 # DW_AT_location 118 .asciz "y" # DW_AT_name 119 .long .Lint # DW_AT_type 120 .byte 0 # End Of Children Mark 121.Lint: 122 .byte 6 # Abbrev [6] 0x6d:0x7 DW_TAG_base_type 123 .asciz "int" # DW_AT_name 124 .byte 5 # DW_AT_encoding 125 .byte 4 # DW_AT_byte_size 126 .byte 0 # End Of Children Mark 127.Ldebug_info_end0: 128