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