459 lines · plain
1# The below program is roughly derived from the following C program.2# To see the annotated debug info, look for the section 3# '.section .debug_info' below.4#5# __attribute__((always_inline))6# void f(void* unused1, int used, int unused2, int partial, int unused3) {7# used += partial;8# printf("f %i", partial);9# printf("f %i", used); // |partial| is not live at this line.10# }11#12# void g(int unused) {13# printf("Hello");14# }15#16# __attribute__((noinline))17# void other() {18# f(nullptr, 1, 0, 2, 0);19# }20#21# int main(int argc, char** argv) {22# f(argv, 42, 1, argc, 2);23# g(1);24# other();25# return 0;26# }27 28 .text29 .file "unused-inlined-params.c"30 31.Lcu_begin:32 33 .globl other34other:35 nop36.Linlined_f_in_other:37break_at_inlined_f_in_other:38 callq printf # Omitted the setup of arguments.39.Linlined_f_in_other_between_printfs:40 callq printf # Omitted the setup of arguments.41.Linlined_f_in_other_end:42 retq43.Lother_end:44 .size other, .Lother_end-other45 46 .globl main47main:48 .file 1 "/example" "unused-inlined-params.c"49 movl $1, %esi50.Linlined_f:51break_at_inlined_f_in_main:52 leal 42(%rsi), %ebx53.Linlined_f_before_printf:54 callq printf # Omitted the setup of arguments.55.Linlined_f_between_printfs:56break_at_inlined_f_in_main_between_printfs:57 callq printf # Omitted the setup of arguments.58.Linlined_f_end:59.Linlined_g:60break_at_inlined_g_in_main:61 callq printf # Omitted the setup of arguments.62.Linlined_g_end:63 callq other64 retq65.Lmain_end:66 .size main, .Lmain_end-main67 68# Dummy printf implementation.69printf:70 retq71 72# Simple entry point to make the linker happy.73 .globl _start74_start:75 jmp main76 77.Lcu_end:78 79 80 .section .debug_loc,"",@progbits81.Ldebug_loc_partial:82 .quad .Linlined_f-.Lcu_begin83 .quad .Linlined_f_between_printfs-.Lcu_begin84 .short 1 # Loc expr size85 .byte 84 # super-register DW_OP_reg486 .quad 087 .quad 088.Ldebug_loc_used:89 .quad .Linlined_f-.Lcu_begin90 .quad .Linlined_f_before_printf-.Lcu_begin91 .short 3 # Loc expr size92 .byte 17 # DW_OP_consts93 .byte 42 # value94 .byte 159 # DW_OP_stack_value95 .quad .Linlined_f_before_printf-.Lcu_begin96 .quad .Linlined_f_end-.Lcu_begin97 .short 1 # Loc expr size98 .byte 83 # super-register DW_OP_reg399 .quad 0100 .quad 0101.Ldebug_loc_partial_in_other:102 .quad .Linlined_f_in_other-.Lcu_begin103 .quad .Linlined_f_in_other_between_printfs-.Lcu_begin104 .short 3 # Loc expr size105 .byte 17 # DW_OP_consts106 .byte 2 # value107 .byte 159 # DW_OP_stack_value108 .quad 0109 .quad 0110.Ldebug_loc_used_in_other:111 .quad .Linlined_f_in_other-.Lcu_begin112 .quad .Linlined_f_in_other_end-.Lcu_begin113 .short 3 # Loc expr size114 .byte 17 # DW_OP_consts115 .byte 1 # value116 .byte 159 # DW_OP_stack_value117 .quad 0118 .quad 0119 120 .section .debug_abbrev,"",@progbits121 .byte 1 # Abbreviation Code122 .byte 17 # DW_TAG_compile_unit123 .byte 1 # DW_CHILDREN_yes124 .byte 3 # DW_AT_name125 .byte 14 # DW_FORM_strp126 .byte 16 # DW_AT_stmt_list127 .byte 23 # DW_FORM_sec_offset128 .byte 17 # DW_AT_low_pc129 .byte 1 # DW_FORM_addr130 .byte 18 # DW_AT_high_pc131 .byte 6 # DW_FORM_data4132 .byte 0 # EOM(1)133 .byte 0 # EOM(2)134 135 .byte 4 # Abbreviation Code136 .byte 5 # DW_TAG_formal_parameter137 .byte 0 # DW_CHILDREN_no138 .byte 2 # DW_AT_location139 .byte 23 # DW_FORM_sec_offset140 .byte 49 # DW_AT_abstract_origin141 .byte 19 # DW_FORM_ref4142 .byte 0 # EOM(1)143 .byte 0 # EOM(2)144 145 .byte 5 # Abbreviation Code146 .byte 46 # DW_TAG_subprogram147 .byte 1 # DW_CHILDREN_yes148 .byte 3 # DW_AT_name149 .byte 14 # DW_FORM_strp150 .byte 58 # DW_AT_decl_file151 .byte 11 # DW_FORM_data1152 .byte 59 # DW_AT_decl_line153 .byte 11 # DW_FORM_data1154 .byte 39 # DW_AT_prototyped155 .byte 25 # DW_FORM_flag_present156 .byte 63 # DW_AT_external157 .byte 25 # DW_FORM_flag_present158 .byte 32 # DW_AT_inline159 .byte 11 # DW_FORM_data1160 .byte 0 # EOM(1)161 .byte 0 # EOM(2)162 163 .byte 6 # Abbreviation Code164 .byte 5 # DW_TAG_formal_parameter165 .byte 0 # DW_CHILDREN_no166 .byte 3 # DW_AT_name167 .byte 14 # DW_FORM_strp168 .byte 58 # DW_AT_decl_file169 .byte 11 # DW_FORM_data1170 .byte 59 # DW_AT_decl_line171 .byte 11 # DW_FORM_data1172 .byte 73 # DW_AT_type173 .byte 19 # DW_FORM_ref4174 .byte 0 # EOM(1)175 .byte 0 # EOM(2)176 177 .byte 7 # Abbreviation Code178 .byte 15 # DW_TAG_pointer_type179 .byte 0 # DW_CHILDREN_no180 .byte 0 # EOM(1)181 .byte 0 # EOM(2)182 183 .byte 8 # Abbreviation Code184 .byte 36 # DW_TAG_base_type185 .byte 0 # DW_CHILDREN_no186 .byte 3 # DW_AT_name187 .byte 14 # DW_FORM_strp188 .byte 62 # DW_AT_encoding189 .byte 11 # DW_FORM_data1190 .byte 11 # DW_AT_byte_size191 .byte 11 # DW_FORM_data1192 .byte 0 # EOM(1)193 .byte 0 # EOM(2)194 195 .byte 9 # Abbreviation Code196 .byte 46 # DW_TAG_subprogram197 .byte 1 # DW_CHILDREN_yes198 .byte 17 # DW_AT_low_pc199 .byte 1 # DW_FORM_addr200 .byte 18 # DW_AT_high_pc201 .byte 6 # DW_FORM_data4202 .byte 64 # DW_AT_frame_base203 .byte 24 # DW_FORM_exprloc204 .byte 3 # DW_AT_name205 .byte 14 # DW_FORM_strp206 .byte 58 # DW_AT_decl_file207 .byte 11 # DW_FORM_data1208 .byte 59 # DW_AT_decl_line209 .byte 11 # DW_FORM_data1210 .byte 39 # DW_AT_prototyped211 .byte 25 # DW_FORM_flag_present212 .byte 73 # DW_AT_type213 .byte 19 # DW_FORM_ref4214 .byte 63 # DW_AT_external215 .byte 25 # DW_FORM_flag_present216 .byte 0 # EOM(1)217 .byte 0 # EOM(2)218 219 .byte 10 # Abbreviation Code220 .byte 5 # DW_TAG_formal_parameter221 .byte 0 # DW_CHILDREN_no222 .byte 2 # DW_AT_location223 .byte 23 # DW_FORM_sec_offset224 .byte 3 # DW_AT_name225 .byte 14 # DW_FORM_strp226 .byte 58 # DW_AT_decl_file227 .byte 11 # DW_FORM_data1228 .byte 59 # DW_AT_decl_line229 .byte 11 # DW_FORM_data1230 .byte 73 # DW_AT_type231 .byte 19 # DW_FORM_ref4232 .byte 0 # EOM(1)233 .byte 0 # EOM(2)234 235 .byte 11 # Abbreviation Code236 .byte 29 # DW_TAG_inlined_subroutine237 .byte 1 # DW_CHILDREN_yes238 .byte 49 # DW_AT_abstract_origin239 .byte 19 # DW_FORM_ref4240 .byte 17 # DW_AT_low_pc241 .byte 1 # DW_FORM_addr242 .byte 18 # DW_AT_high_pc243 .byte 6 # DW_FORM_data4244 .byte 88 # DW_AT_call_file245 .byte 11 # DW_FORM_data1246 .byte 89 # DW_AT_call_line247 .byte 11 # DW_FORM_data1248 .byte 87 # DW_AT_call_column249 .byte 11 # DW_FORM_data1250 .byte 0 # EOM(1)251 .byte 0 # EOM(2)252 253 .byte 12 # Abbreviation Code254 .byte 15 # DW_TAG_pointer_type255 .byte 0 # DW_CHILDREN_no256 .byte 73 # DW_AT_type257 .byte 19 # DW_FORM_ref4258 .byte 0 # EOM(1)259 .byte 0 # EOM(2)260 .byte 0 # EOM(3)261 262 .section .debug_info,"",@progbits263.Ldi_cu_begin:264 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit265.Ldebug_info_start0:266 .short 4 # DWARF version number267 .long .debug_abbrev # Offset Into Abbrev. Section268 .byte 8 # Address Size (in bytes)269 .byte 1 # Abbrev [1] DW_TAG_compile_unit270 .long .Linfo_string_fname # DW_AT_name271 .long .Lline_table_start0 # DW_AT_stmt_list272 .quad .Lcu_begin # DW_AT_low_pc273 .long .Lcu_end-.Lcu_begin # DW_AT_high_pc274 275# Debug info for |f| (abstract version with all parameters).276 277.Ldebug_info_f:278 .byte 5 # Abbrev [5] DW_TAG_subprogram279 .long .Linfo_string_f # DW_AT_name280 .byte 1 # DW_AT_decl_file281 .byte 4 # DW_AT_decl_line282 # DW_AT_prototyped283 # DW_AT_external284 .byte 1 # DW_AT_inline285.Ldebug_info_param1:286 .byte 6 # Abbrev [6] DW_TAG_formal_parameter287 .long .Linfo_string_unused1 # DW_AT_name288 .byte 1 # DW_AT_decl_file289 .byte 4 # DW_AT_decl_line290 .long .Ldebug_info_void_ptr-.Ldi_cu_begin291 # DW_AT_type292.Ldebug_info_param2:293 .byte 6 # Abbrev [6] DW_TAG_formal_parameter294 .long .Linfo_string_used # DW_AT_name295 .byte 1 # DW_AT_decl_file296 .byte 4 # DW_AT_decl_line297 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type298.Ldebug_info_param3:299 .byte 6 # Abbrev [6] DW_TAG_formal_parameter300 .long .Linfo_string_unused2 # DW_AT_name301 .byte 1 # DW_AT_decl_file302 .byte 4 # DW_AT_decl_line303 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type304.Ldebug_info_param4:305 .byte 6 # Abbrev [6] DW_TAG_formal_parameter306 .long .Linfo_string_partial # DW_AT_name307 .byte 1 # DW_AT_decl_file308 .byte 4 # DW_AT_decl_line309 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type310.Ldebug_info_param5:311 .byte 6 # Abbrev [6] DW_TAG_formal_parameter312 .long .Linfo_string_unused3 # DW_AT_name313 .byte 1 # DW_AT_decl_file314 .byte 4 # DW_AT_decl_line315 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type316 .byte 0 # End Of Children Mark (DW_TAG_subprogram)317 318# Debug info for |g| (abstract version with all parameters).319 320.Ldebug_info_g:321 .byte 5 # Abbrev [5] DW_TAG_subprogram322 .long .Linfo_string_g # DW_AT_name323 .byte 1 # DW_AT_decl_file324 .byte 4 # DW_AT_decl_line325 # DW_AT_prototyped326 # DW_AT_external327 .byte 1 # DW_AT_inline328.Ldebug_info_g_param1:329 .byte 6 # Abbrev [6] DW_TAG_formal_parameter330 .long .Linfo_string_unused # DW_AT_name331 .byte 1 # DW_AT_decl_file332 .byte 10 # DW_AT_decl_line333 .long .Ldebug_info_int-.Ldi_cu_begin334 .byte 0 # End Of Children Mark (DW_TAG_subprogram)335 336# Debug info for |main|.337 338 .byte 9 # Abbrev [9] DW_TAG_subprogram339 .quad main # DW_AT_low_pc340 .long .Lmain_end-main # DW_AT_high_pc341 .byte 1 # DW_AT_frame_base342 .byte 87343 .long .Linfo_string_main # DW_AT_name344 .byte 1 # DW_AT_decl_file345 .byte 18 # DW_AT_decl_line346 # DW_AT_prototyped347 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type348 # DW_AT_external349 350# Debug info for concrete |f| inlined into |main|.351 352 .byte 11 # Abbrev [11] DW_TAG_inlined_subroutine353 .long .Ldebug_info_f-.Ldi_cu_begin354 # DW_AT_abstract_origin355 .quad .Linlined_f # DW_AT_low_pc356 .long .Linlined_f_end-.Linlined_f # DW_AT_high_pc357 .byte 1 # DW_AT_call_file358 .byte 20 # DW_AT_call_line359 .byte 3 # DW_AT_call_column360 .byte 4 # Abbrev [4] DW_TAG_formal_parameter361 .long .Ldebug_loc_used # DW_AT_location362 .long .Ldebug_info_param2-.Ldi_cu_begin363 # DW_AT_abstract_origin364 .byte 4 # Abbrev [4] DW_TAG_formal_parameter365 .long .Ldebug_loc_partial # DW_AT_location366 .long .Ldebug_info_param4-.Ldi_cu_begin367 # DW_AT_abstract_origin368 .byte 0 # End Of Children Mark (DW_TAG_inlined_subroutine)369 370# Debug info for concrete |g| inlined into |main|.371 372 .byte 11 # Abbrev [11] DW_TAG_inlined_subroutine373 .long .Ldebug_info_g-.Ldi_cu_begin374 # DW_AT_abstract_origin375 .quad .Linlined_g # DW_AT_low_pc376 .long .Linlined_g_end-.Linlined_g # DW_AT_high_pc377 .byte 1 # DW_AT_call_file378 .byte 21 # DW_AT_call_line379 .byte 3 # DW_AT_call_column380 .byte 0 # End Of Children Mark (DW_TAG_inlined_subroutine)381 382 .byte 0 # End Of Children Mark (DW_TAG_subprogram)383 384# Debug info for |other|.385 386 .byte 9 # Abbrev [9] DW_TAG_subprogram387 .quad other # DW_AT_low_pc388 .long .Lother_end-other # DW_AT_high_pc389 .byte 1 # DW_AT_frame_base390 .byte 87391 .long .Linfo_string_other # DW_AT_name392 .byte 1 # DW_AT_decl_file393 .byte 15 # DW_AT_decl_line394 # DW_AT_prototyped395 .long .Ldebug_info_int-.Ldi_cu_begin # DW_AT_type396 # DW_AT_external397 398# Debug info for concrete |f| inlined into |other|.399 400 .byte 11 # Abbrev [11] DW_TAG_inlined_subroutine401 .long .Ldebug_info_f-.Ldi_cu_begin402 # DW_AT_abstract_origin403 .quad .Linlined_f_in_other # DW_AT_low_pc404 .long .Linlined_f_in_other_end-.Linlined_f_in_other405 # DW_AT_high_pc406 .byte 1 # DW_AT_call_file407 .byte 16 # DW_AT_call_line408 .byte 3 # DW_AT_call_column409 .byte 4 # Abbrev [4] DW_TAG_formal_parameter410 .long .Ldebug_loc_used_in_other # DW_AT_location411 .long .Ldebug_info_param2-.Ldi_cu_begin412 # DW_AT_abstract_origin413 .byte 4 # Abbrev [4] DW_TAG_formal_parameter414 .long .Ldebug_loc_partial_in_other # DW_AT_location415 .long .Ldebug_info_param4-.Ldi_cu_begin416 # DW_AT_abstract_origin417 .byte 0 # End Of Children Mark (DW_TAG_inlined_subroutine)418 .byte 0 # End Of Children Mark (DW_TAG_subprogram)419 420.Ldebug_info_void_ptr:421 .byte 7 # Abbrev [7] DW_TAG_pointer_type422.Ldebug_info_int:423 .byte 8 # Abbrev [8] DW_TAG_base_type424 .long .Linfo_string_int # DW_AT_name425 .byte 5 # DW_AT_encoding426 .byte 4 # DW_AT_byte_size427 428 .byte 0 # End Of Children Mark (DW_TAG_compile_unit)429.Ldebug_info_end0:430 .section .debug_str,"MS",@progbits,1431.Linfo_string_fname:432 .asciz "unused-inlined-params.c"433.Linfo_string_f:434 .asciz "f"435.Linfo_string_unused1:436 .asciz "unused1"437.Linfo_string_used:438 .asciz "used"439.Linfo_string_int:440 .asciz "int"441.Linfo_string_unused2:442 .asciz "unused2"443.Linfo_string_partial:444 .asciz "partial"445.Linfo_string_unused3:446 .asciz "unused3"447.Linfo_string_main:448 .asciz "main"449.Linfo_string_g:450 .asciz "g"451.Linfo_string_unused:452 .asciz "unused"453.Linfo_string_other:454 .asciz "other"455 .section ".note.GNU-stack","",@progbits456 .addrsig457 .section .debug_line,"",@progbits458.Lline_table_start0:459