1# clang++ -ffunction-sections -g2 -gdwarf-4 2# Manually modified to use ranges like what generates sometimes -fbasic-block-sections=all, 3# and changed start of range to 0. 4# int doStuff(int val) { 5# if (val) 6# ++val; 7# return val; 8# } 9# 10# int main(int argc, const char** argv) { 11# return doStuff(argc); 12# } 13 .text 14 .file "main.cpp" 15 .section .text._Z7doStuffi,"ax",@progbits 16 .globl _Z7doStuffi # -- Begin function _Z7doStuffi 17 .p2align 4, 0x90 18 .type _Z7doStuffi,@function 19_Z7doStuffi: # @_Z7doStuffi 20.Lfunc_begin0: 21 .file 1 "/subprogramRanges" "main.cpp" 22 .loc 1 1 0 # main.cpp:1:0 23 .cfi_startproc 24# %bb.0: # %entry 25 pushq %rbp 26 .cfi_def_cfa_offset 16 27 .cfi_offset %rbp, -16 28 movq %rsp, %rbp 29 .cfi_def_cfa_register %rbp 30 movl %edi, -4(%rbp) 31.Ltmp0: 32 .loc 1 2 7 prologue_end # main.cpp:2:7 33 cmpl $0, -4(%rbp) 34.Ltmp1: 35 .loc 1 2 7 is_stmt 0 # main.cpp:2:7 36 je .LBB0_2 37# %bb.1: # %if.then 38.Ltmp2: 39 .loc 1 3 5 is_stmt 1 # main.cpp:3:5 40 movl -4(%rbp), %eax 41 addl $1, %eax 42 movl %eax, -4(%rbp) 43.Ltmp3: 44.LBB0_2: # %if.end 45 .loc 1 4 10 # main.cpp:4:10 46 movl -4(%rbp), %eax 47 .loc 1 4 3 epilogue_begin is_stmt 0 # main.cpp:4:3 48 popq %rbp 49 .cfi_def_cfa %rsp, 8 50 retq 51.Ltmp4: 52.Lfunc_end0: 53 .size _Z7doStuffi, .Lfunc_end0-_Z7doStuffi 54 .cfi_endproc 55 # -- End function 56 .section .text.main,"ax",@progbits 57 .globl main # -- Begin function main 58 .p2align 4, 0x90 59 .type main,@function 60main: # @main 61.Lfunc_begin1: 62 .loc 1 7 0 is_stmt 1 # main.cpp:7:0 63 .cfi_startproc 64# %bb.0: # %entry 65 pushq %rbp 66 .cfi_def_cfa_offset 16 67 .cfi_offset %rbp, -16 68 movq %rsp, %rbp 69 .cfi_def_cfa_register %rbp 70 subq $16, %rsp 71 movl $0, -4(%rbp) 72 movl %edi, -8(%rbp) 73 movq %rsi, -16(%rbp) 74.Ltmp5: 75 .loc 1 8 21 prologue_end # main.cpp:8:21 76 movl -8(%rbp), %edi 77 .loc 1 8 13 is_stmt 0 # main.cpp:8:13 78 callq _Z7doStuffi 79 .loc 1 8 5 epilogue_begin # main.cpp:8:5 80 addq $16, %rsp 81 popq %rbp 82 .cfi_def_cfa %rsp, 8 83 retq 84.Ltmp6: 85.Lfunc_end1: 86 .size main, .Lfunc_end1-main 87 .cfi_endproc 88 # -- End function 89 .section .debug_abbrev,"",@progbits 90 .byte 1 # Abbreviation Code 91 .byte 17 # DW_TAG_compile_unit 92 .byte 1 # DW_CHILDREN_yes 93 .byte 37 # DW_AT_producer 94 .byte 14 # DW_FORM_strp 95 .byte 19 # DW_AT_language 96 .byte 5 # DW_FORM_data2 97 .byte 3 # DW_AT_name 98 .byte 14 # DW_FORM_strp 99 .byte 16 # DW_AT_stmt_list 100 .byte 23 # DW_FORM_sec_offset 101 .byte 27 # DW_AT_comp_dir 102 .byte 14 # DW_FORM_strp 103 .byte 17 # DW_AT_low_pc 104 .byte 1 # DW_FORM_addr 105 .byte 85 # DW_AT_ranges 106 .byte 23 # DW_FORM_sec_offset 107 .byte 0 # EOM(1) 108 .byte 0 # EOM(2) 109 .byte 2 # Abbreviation Code 110 .byte 46 # DW_TAG_subprogram 111 .byte 1 # DW_CHILDREN_yes 112 .byte 85 # DW_AT_ranges 113 .byte 23 # DW_FORM_sec_offset 114 .byte 64 # DW_AT_frame_base 115 .byte 24 # DW_FORM_exprloc 116 .byte 110 # DW_AT_linkage_name 117 .byte 14 # DW_FORM_strp 118 .byte 3 # DW_AT_name 119 .byte 14 # DW_FORM_strp 120 .byte 58 # DW_AT_decl_file 121 .byte 11 # DW_FORM_data1 122 .byte 59 # DW_AT_decl_line 123 .byte 11 # DW_FORM_data1 124 .byte 73 # DW_AT_type 125 .byte 19 # DW_FORM_ref4 126 .byte 63 # DW_AT_external 127 .byte 25 # DW_FORM_flag_present 128 .byte 0 # EOM(1) 129 .byte 0 # EOM(2) 130 .byte 3 # Abbreviation Code 131 .byte 5 # DW_TAG_formal_parameter 132 .byte 0 # DW_CHILDREN_no 133 .byte 2 # DW_AT_location 134 .byte 24 # DW_FORM_exprloc 135 .byte 3 # DW_AT_name 136 .byte 14 # DW_FORM_strp 137 .byte 58 # DW_AT_decl_file 138 .byte 11 # DW_FORM_data1 139 .byte 59 # DW_AT_decl_line 140 .byte 11 # DW_FORM_data1 141 .byte 73 # DW_AT_type 142 .byte 19 # DW_FORM_ref4 143 .byte 0 # EOM(1) 144 .byte 0 # EOM(2) 145 .byte 4 # Abbreviation Code 146 .byte 46 # DW_TAG_subprogram 147 .byte 1 # DW_CHILDREN_yes 148 .byte 17 # DW_AT_low_pc 149 .byte 1 # DW_FORM_addr 150 .byte 18 # DW_AT_high_pc 151 .byte 6 # DW_FORM_data4 152 .byte 64 # DW_AT_frame_base 153 .byte 24 # DW_FORM_exprloc 154 .byte 3 # DW_AT_name 155 .byte 14 # DW_FORM_strp 156 .byte 58 # DW_AT_decl_file 157 .byte 11 # DW_FORM_data1 158 .byte 59 # DW_AT_decl_line 159 .byte 11 # DW_FORM_data1 160 .byte 73 # DW_AT_type 161 .byte 19 # DW_FORM_ref4 162 .byte 63 # DW_AT_external 163 .byte 25 # DW_FORM_flag_present 164 .byte 0 # EOM(1) 165 .byte 0 # EOM(2) 166 .byte 5 # Abbreviation Code 167 .byte 36 # DW_TAG_base_type 168 .byte 0 # DW_CHILDREN_no 169 .byte 3 # DW_AT_name 170 .byte 14 # DW_FORM_strp 171 .byte 62 # DW_AT_encoding 172 .byte 11 # DW_FORM_data1 173 .byte 11 # DW_AT_byte_size 174 .byte 11 # DW_FORM_data1 175 .byte 0 # EOM(1) 176 .byte 0 # EOM(2) 177 .byte 6 # Abbreviation Code 178 .byte 15 # DW_TAG_pointer_type 179 .byte 0 # DW_CHILDREN_no 180 .byte 73 # DW_AT_type 181 .byte 19 # DW_FORM_ref4 182 .byte 0 # EOM(1) 183 .byte 0 # EOM(2) 184 .byte 7 # Abbreviation Code 185 .byte 38 # DW_TAG_const_type 186 .byte 0 # DW_CHILDREN_no 187 .byte 73 # DW_AT_type 188 .byte 19 # DW_FORM_ref4 189 .byte 0 # EOM(1) 190 .byte 0 # EOM(2) 191 .byte 0 # EOM(3) 192 .section .debug_info,"",@progbits 193.Lcu_begin0: 194 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 195.Ldebug_info_start0: 196 .short 4 # DWARF version number 197 .long .debug_abbrev # Offset Into Abbrev. Section 198 .byte 8 # Address Size (in bytes) 199 .byte 1 # Abbrev [1] 0xb:0x9f DW_TAG_compile_unit 200 .long .Linfo_string0 # DW_AT_producer 201 .short 33 # DW_AT_language 202 .long .Linfo_string1 # DW_AT_name 203 .long .Lline_table_start0 # DW_AT_stmt_list 204 .long .Linfo_string2 # DW_AT_comp_dir 205 .quad 0 # DW_AT_low_pc 206 .long .Ldebug_ranges0 # DW_AT_ranges 207 .byte 2 # Abbrev [2] 0x2a:0x2c DW_TAG_subprogram 208 .long .Ldebug_ranges1 # DW_AT_ranges 209 .byte 1 # DW_AT_frame_base 210 .byte 86 211 .long .Linfo_string3 # DW_AT_linkage_name 212 .long .Linfo_string4 # DW_AT_name 213 .byte 1 # DW_AT_decl_file 214 .byte 1 # DW_AT_decl_line 215 .long 132 # DW_AT_type 216 # DW_AT_external 217 .byte 3 # Abbrev [3] 0x47:0xe DW_TAG_formal_parameter 218 .byte 2 # DW_AT_location 219 .byte 145 220 .byte 124 221 .long .Linfo_string7 # DW_AT_name 222 .byte 1 # DW_AT_decl_file 223 .byte 1 # DW_AT_decl_line 224 .long 132 # DW_AT_type 225 .byte 0 # End Of Children Mark 226 .byte 4 # Abbrev [4] 0x56:0x36 DW_TAG_subprogram 227 .quad .Lfunc_begin1 # DW_AT_low_pc 228 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc 229 .byte 1 # DW_AT_frame_base 230 .byte 86 231 .long .Linfo_string6 # DW_AT_name 232 .byte 1 # DW_AT_decl_file 233 .byte 7 # DW_AT_decl_line 234 .long 132 # DW_AT_type 235 # DW_AT_external 236 .byte 3 # Abbrev [3] 0x6f:0xe DW_TAG_formal_parameter 237 .byte 2 # DW_AT_location 238 .byte 145 239 .byte 120 240 .long .Linfo_string8 # DW_AT_name 241 .byte 1 # DW_AT_decl_file 242 .byte 7 # DW_AT_decl_line 243 .long 132 # DW_AT_type 244 .byte 3 # Abbrev [3] 0x7d:0xe DW_TAG_formal_parameter 245 .byte 2 # DW_AT_location 246 .byte 145 247 .byte 112 248 .long .Linfo_string9 # DW_AT_name 249 .byte 1 # DW_AT_decl_file 250 .byte 7 # DW_AT_decl_line 251 .long 144 # DW_AT_type 252 .byte 0 # End Of Children Mark 253 .byte 5 # Abbrev [5] 0x8c:0x7 DW_TAG_base_type 254 .long .Linfo_string5 # DW_AT_name 255 .byte 5 # DW_AT_encoding 256 .byte 4 # DW_AT_byte_size 257 .byte 6 # Abbrev [6] 0x93:0x5 DW_TAG_pointer_type 258 .long 144 # DW_AT_type 259 .byte 6 # Abbrev [6] 0x98:0x5 DW_TAG_pointer_type 260 .long 149 # DW_AT_type 261 .byte 7 # Abbrev [7] 0x9d:0x5 DW_TAG_const_type 262 .long 154 # DW_AT_type 263 .byte 5 # Abbrev [5] 0xa2:0x7 DW_TAG_base_type 264 .long .Linfo_string10 # DW_AT_name 265 .byte 6 # DW_AT_encoding 266 .byte 1 # DW_AT_byte_size 267 .byte 0 # End Of Children Mark 268.Ldebug_info_end0: 269 .section .debug_ranges,"",@progbits 270.Ldebug_ranges0: 271 .quad .Lfunc_begin0 272 .quad .Lfunc_end0 273 .quad .Lfunc_begin1 274 .quad .Lfunc_end1 275 .quad 0 276 .quad 0 277.Ldebug_ranges1: 278 .quad 0 279 .quad .Lfunc_end0 280 .quad 0 281 .quad 0 282 .section .debug_str,"MS",@progbits,1 283.Linfo_string0: 284 .asciz "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 640e07c49037cca41a1bfbeb916b569d8c950aea)" # string offset=0 285.Linfo_string1: 286 .asciz "main.cpp" # string offset=105 287.Linfo_string2: 288 .asciz "/subprogramRanges" # string offset=114 289.Linfo_string3: 290 .asciz "_Z7doStuffi" # string offset=169 291.Linfo_string4: 292 .asciz "doStuff" # string offset=181 293.Linfo_string5: 294 .asciz "int" # string offset=189 295.Linfo_string6: 296 .asciz "main" # string offset=193 297.Linfo_string7: 298 .asciz "val" # string offset=198 299.Linfo_string8: 300 .asciz "argc" # string offset=202 301.Linfo_string9: 302 .asciz "argv" # string offset=207 303.Linfo_string10: 304 .asciz "char" # string offset=212 305 .ident "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 640e07c49037cca41a1bfbeb916b569d8c950aea)" 306 .section ".note.GNU-stack","",@progbits 307 .addrsig 308 .addrsig_sym _Z7doStuffi 309 .section .debug_line,"",@progbits 310.Lline_table_start0: 311