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