233 lines · plain
1 # Test handling of values represented via DW_OP_div2 # RUN: %clang -c --target=x86_64-pc-linux -o %t %s3 # RUN: %lldb %t -o "expression -T -- g" -o "exit" | FileCheck %s4 5 # Failing case was:6 # (int) $0 = 07 # CHECK: (int) $0 = 28 #9 # This file is crafted by hand on the basis of a very simple C program.10 11 # The original (NOT THIS FILE) error-triggering code is:12 # #include "stdint.h"13 # static volatile uint64_t g = 0;14 # static const int32_t f()15 # {16 # uint32_t i;17 # for (i = 0; (i != 10); i++)18 # ++g;19 # return 0;20 # 21 # }22 #23 # int main()24 # {25 # f();26 # return 0;27 # 28 # }29 # When the above code is compiled by Clang 15.0.7 with -O1, it generates desired DW_OP_div for testing.30 # Due to cross-platform issue, this case is hand-crafted for testing.31 32 .text33 .file "DW_OP_div-with-signed.c"34 .file 0 "DW_OP_div-with-signed.c" # Dummy file35 .globl main # -- Begin function main36 .p2align 4, 0x9037 .type main,@function38main: # @main39.Lfunc_begin0:40 .loc 0 4 0 # DW_OP_div-with-signed.c:4:041 .cfi_startproc42# %bb.0:43 .loc 0 5 5 prologue_end # DW_OP_div-with-signed.c:5:544 xorl %eax, %eax45 retq46.Ltmp0:47.Lfunc_end0:48 .size main, .Lfunc_end0-main49 .cfi_endproc50 # -- End function51 .type g,@object # @g52 .data53 .globl g54 .p2align 2, 0x055g:56 .long 3735928559 # 0xdeadbeef57 .size g, 458 59 .section .debug_abbrev,"",@progbits60 .byte 1 # Abbreviation Code61 .byte 17 # DW_TAG_compile_unit62 .byte 1 # DW_CHILDREN_yes63 .byte 37 # DW_AT_producer64 .byte 37 # DW_FORM_strx165 .byte 19 # DW_AT_language66 .byte 5 # DW_FORM_data267 .byte 3 # DW_AT_name68 .byte 37 # DW_FORM_strx169 .byte 114 # DW_AT_str_offsets_base70 .byte 23 # DW_FORM_sec_offset71 .byte 16 # DW_AT_stmt_list72 .byte 23 # DW_FORM_sec_offset73 .byte 27 # DW_AT_comp_dir74 .byte 37 # DW_FORM_strx175 .byte 17 # DW_AT_low_pc76 .byte 27 # DW_FORM_addrx77 .byte 18 # DW_AT_high_pc78 .byte 6 # DW_FORM_data479 .byte 115 # DW_AT_addr_base80 .byte 23 # DW_FORM_sec_offset81 .byte 0 # EOM(1)82 .byte 0 # EOM(2)83 .byte 2 # Abbreviation Code84 .byte 52 # DW_TAG_variable85 .byte 0 # DW_CHILDREN_no86 .byte 3 # DW_AT_name87 .byte 37 # DW_FORM_strx188 .byte 73 # DW_AT_type89 .byte 19 # DW_FORM_ref490 .byte 63 # DW_AT_external91 .byte 25 # DW_FORM_flag_present92 .byte 58 # DW_AT_decl_file93 .byte 11 # DW_FORM_data194 .byte 59 # DW_AT_decl_line95 .byte 11 # DW_FORM_data196 .byte 2 # DW_AT_location97 .byte 24 # DW_FORM_exprloc98 .byte 0 # EOM(1)99 .byte 0 # EOM(2)100 .byte 3 # Abbreviation Code101 .byte 36 # DW_TAG_base_type102 .byte 0 # DW_CHILDREN_no103 .byte 3 # DW_AT_name104 .byte 37 # DW_FORM_strx1105 .byte 62 # DW_AT_encoding106 .byte 11 # DW_FORM_data1107 .byte 11 # DW_AT_byte_size108 .byte 11 # DW_FORM_data1109 .byte 0 # EOM(1)110 .byte 0 # EOM(2)111 .byte 4 # Abbreviation Code112 .byte 46 # DW_TAG_subprogram113 .byte 0 # DW_CHILDREN_no114 .byte 17 # DW_AT_low_pc115 .byte 27 # DW_FORM_addrx116 .byte 18 # DW_AT_high_pc117 .byte 6 # DW_FORM_data4118 .byte 64 # DW_AT_frame_base119 .byte 24 # DW_FORM_exprloc120 .byte 122 # DW_AT_call_all_calls121 .byte 25 # DW_FORM_flag_present122 .byte 3 # DW_AT_name123 .byte 37 # DW_FORM_strx1124 .byte 58 # DW_AT_decl_file125 .byte 11 # DW_FORM_data1126 .byte 59 # DW_AT_decl_line127 .byte 11 # DW_FORM_data1128 .byte 73 # DW_AT_type129 .byte 19 # DW_FORM_ref4130 .byte 63 # DW_AT_external131 .byte 25 # DW_FORM_flag_present132 .byte 0 # EOM(1)133 .byte 0 # EOM(2)134 .byte 0 # EOM(3)135 .section .debug_info,"",@progbits136.Lcu_begin0:137 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit138.Ldebug_info_start0:139 .short 5 # DWARF version number140 .byte 1 # DWARF Unit Type141 .byte 8 # Address Size (in bytes)142 .long .debug_abbrev # Offset Into Abbrev. Section143 .byte 1 # Abbrev [1] 0xc:0x36 DW_TAG_compile_unit144 .byte 0 # DW_AT_producer145 .short 29 # DW_AT_language146 .byte 1 # DW_AT_name147 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base148 .long .Lline_table_start0 # DW_AT_stmt_list149 .byte 2 # DW_AT_comp_dir150 .byte 1 # DW_AT_low_pc151 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc152 .long .Laddr_table_base0 # DW_AT_addr_base153 .byte 2 # Abbrev [2] 0x23:0xb DW_TAG_variable154 .byte 3 # DW_AT_name155 .long 60 # DW_AT_type156 # DW_AT_external157 .byte 0 # DW_AT_decl_file158 .byte 1 # DW_AT_decl_line159 .byte 16 # DW_AT_location160 .byte 49161 .byte 49162 .byte 16 # DW_OP_constu163 .byte 255 # 4294967295164 .byte 255 # 165 .byte 255 # 166 .byte 255 # 167 .byte 15 # 168 .byte 26 # DW_OP_and169 .byte 17 # DW_OP_consts170 .byte 3 # 3171 .byte 28 # DW_OP_minus172 .byte 17 # DW_OP_consts173 .byte 127 # -1174 .byte 27 # DW_OP_div175 .byte 159176 .byte 3 # Abbrev [3] 0x2e:0x4 DW_TAG_base_type177 .byte 4 # DW_AT_name178 .byte 5 # DW_AT_encoding179 .byte 4 # DW_AT_byte_size180 .byte 4 # Abbrev [4] 0x32:0xf DW_TAG_subprogram181 .byte 1 # DW_AT_low_pc182 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc183 .byte 1 # DW_AT_frame_base184 .byte 87185 # DW_AT_call_all_calls186 .byte 5 # DW_AT_name187 .byte 0 # DW_AT_decl_file188 .byte 3 # DW_AT_decl_line189 .long 60 # DW_AT_type190 # DW_AT_external191 .byte 0 # End Of Children Mark192.Ldebug_info_end0:193 .section .debug_str_offsets,"",@progbits194 .long 28 # Length of String Offsets Set195 .short 5196 .short 0197.Lstr_offsets_base0:198 .section .debug_str,"MS",@progbits,1199.Linfo_string0:200 .asciz "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 1b18ab358a8e91e69a54f676c77f6a4cda8ba02d)" # string offset=0201.Linfo_string1:202 .asciz "DW_OP_div-with-signed.c" # string offset=105203.Linfo_string2:204 .asciz "" # string offset=129205.Linfo_string3:206 .asciz "g" # string offset=166207.Linfo_string4:208 .asciz "int" # string offset=168209.Linfo_string5:210 .asciz "main" # string offset=172211 .section .debug_str_offsets,"",@progbits212 .long .Linfo_string0213 .long .Linfo_string1214 .long .Linfo_string2215 .long .Linfo_string3216 .long .Linfo_string4217 .long .Linfo_string5218 .section .debug_addr,"",@progbits219 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution220.Ldebug_addr_start0:221 .short 5 # DWARF version number222 .byte 8 # Address size223 .byte 0 # Segment selector size224.Laddr_table_base0:225 .quad g226 .quad .Lfunc_begin0227.Ldebug_addr_end0:228 .ident "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 1b18ab358a8e91e69a54f676c77f6a4cda8ba02d)"229 .section ".note.GNU-stack","",@progbits230 .addrsig231 .section .debug_line,"",@progbits232.Lline_table_start0:233