From: Tom de Vries Date: Fri, 23 Oct 2020 12:55:04 +0000 (+0200) Subject: [gdb/testsuite] Use $srcfile in DW_AT_name for CU X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9476b583cb3e72e57355f5a6bfcd5ba69e71ea31;p=binutils-gdb.git [gdb/testsuite] Use $srcfile in DW_AT_name for CU In dwarf assembly test-case ada-linkage-name.exp, we have: ... standard_testfile .c -debug.S ... cu {} { DW_TAG_compile_unit { {DW_AT_name ada-linkage-name.c} ... Use $srcfile instead of ada-linkage-name.c. In dwarf assembly test-case atomic-type.exp, we have: ... standard_testfile .c -dw.S ... cu {} { DW_TAG_compile_unit { {DW_AT_name atomic-type-dw.c} ... The dwarf generated into atomic-type-dw.S is meant to represent the code in atomic-type.c, not atomic-type-dw.c, so use $srcfile instead of atomic-type-dw.c. Fix these and similar. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-23 Tom de Vries * gdb.dwarf2/ada-linkage-name.exp: Use $srcfile for DW_AT_name of CU. * gdb.dwarf2/atomic-type.exp: Same. * gdb.dwarf2/bad-regnum.exp: Same. * gdb.dwarf2/cpp-linkage-name.exp: Same. * gdb.dwarf2/dw2-align.exp: Same. * gdb.dwarf2/dw2-bad-elf.exp: Same. * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same. * gdb.dwarf2/dw2-bad-unresolved.exp: Same. * gdb.dwarf2/dw2-namespaceless-anonymous.exp: Same. * gdb.dwarf2/dw2-opt-structptr.exp: Same. * gdb.dwarf2/dw2-unusual-field-names.exp: Same. * gdb.dwarf2/enum-type.exp: Same. * gdb.dwarf2/frame-inlined-in-outer-frame.exp: Same. * gdb.dwarf2/info-locals-optimized-out.exp: Same. * gdb.dwarf2/main-subprogram.exp: Same. * gdb.dwarf2/missing-type-name.exp: Same. * gdb.dwarf2/nonvar-access.exp: Same. * gdb.dwarf2/typedef-void-finish.exp: Same. * gdb.dwarf2/var-access.exp: Same. * gdb.dwarf2/void-type.exp: Same. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f75c7327863..2683237a34f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,26 @@ +2020-10-23 Tom de Vries + + * gdb.dwarf2/ada-linkage-name.exp: Use $srcfile for DW_AT_name of CU. + * gdb.dwarf2/atomic-type.exp: Same. + * gdb.dwarf2/bad-regnum.exp: Same. + * gdb.dwarf2/cpp-linkage-name.exp: Same. + * gdb.dwarf2/dw2-align.exp: Same. + * gdb.dwarf2/dw2-bad-elf.exp: Same. + * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same. + * gdb.dwarf2/dw2-bad-unresolved.exp: Same. + * gdb.dwarf2/dw2-namespaceless-anonymous.exp: Same. + * gdb.dwarf2/dw2-opt-structptr.exp: Same. + * gdb.dwarf2/dw2-unusual-field-names.exp: Same. + * gdb.dwarf2/enum-type.exp: Same. + * gdb.dwarf2/frame-inlined-in-outer-frame.exp: Same. + * gdb.dwarf2/info-locals-optimized-out.exp: Same. + * gdb.dwarf2/main-subprogram.exp: Same. + * gdb.dwarf2/missing-type-name.exp: Same. + * gdb.dwarf2/nonvar-access.exp: Same. + * gdb.dwarf2/typedef-void-finish.exp: Same. + * gdb.dwarf2/var-access.exp: Same. + * gdb.dwarf2/void-type.exp: Same. + 2020-10-22 Simon Marchi PR gdb/26693 diff --git a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp index 0b440c8e6da..870a7550f08 100644 --- a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp +++ b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp @@ -34,7 +34,7 @@ Dwarf::assemble $asm_file { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_Ada95} - {DW_AT_name ada-linkage-name.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { diff --git a/gdb/testsuite/gdb.dwarf2/atomic-type.exp b/gdb/testsuite/gdb.dwarf2/atomic-type.exp index d28af05d26e..1058d2db9ce 100644 --- a/gdb/testsuite/gdb.dwarf2/atomic-type.exp +++ b/gdb/testsuite/gdb.dwarf2/atomic-type.exp @@ -25,10 +25,12 @@ standard_testfile .c -dw.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C11} - {DW_AT_name atomic-type-dw.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels i_l c_l c_c_l ac_c_l pac_c_l vpac_c_l avpac_c_l diff --git a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp index acd739f7a50..600ec56a720 100644 --- a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp +++ b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp @@ -25,10 +25,12 @@ standard_testfile main.c -dw.S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name bad-regnum-dw.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels integer_label diff --git a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp index f2c88b9b553..a1077b5a825 100644 --- a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp +++ b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp @@ -30,10 +30,12 @@ standard_testfile .c -debug.S # Set up the DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C_plus_plus} - {DW_AT_name ada-linkage-name.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-align.exp b/gdb/testsuite/gdb.dwarf2/dw2-align.exp index 640216ae192..4ad4fe811cf 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-align.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-align.exp @@ -30,7 +30,7 @@ Dwarf::assemble $asm_file { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C_plus_plus} - {DW_AT_name dw2-align.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels itype ptype diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp index a85d3430a75..e939046e961 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp @@ -39,7 +39,7 @@ standard_testfile main.c -other.S -dwarf.S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile3] Dwarf::assemble $asm_file { - global srcdir subdir srcfile + global srcdir subdir srcfile srcfile2 declare_labels ranges_label_1 ranges_label_2 L1 L2 @@ -52,7 +52,7 @@ Dwarf::assemble $asm_file { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name dw2-bad-elf.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir ${srcdir}/${subdir}} {stmt_list $L1 DW_FORM_sec_offset} {ranges ${ranges_label_1} DW_FORM_sec_offset} @@ -80,7 +80,7 @@ Dwarf::assemble $asm_file { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name dw2-bad-elf-other.c} + {DW_AT_name $srcfile2} {DW_AT_comp_dir ${srcdir}/${subdir}} {stmt_list $L2 DW_FORM_sec_offset} {ranges ${ranges_label_2} DW_FORM_sec_offset} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp index 238297c76ae..bfb95215eb8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp @@ -26,10 +26,12 @@ standard_testfile .c .S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C_plus_plus} - {DW_AT_name dw2-bad-mips-linkage-name.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp index 44d5faa97bd..e93f2ce938d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp @@ -28,10 +28,12 @@ standard_testfile .c -2.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name dw2-bad-unresolved-2.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels b_l diff --git a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp index a6d9a500287..bba05e4d5c3 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp @@ -30,7 +30,7 @@ Dwarf::assemble $asm_file { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C_plus_plus} - {DW_AT_name dw2-namespaceless-anonymous.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels myint diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp index 496eddcc861..332e8439eb0 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp @@ -41,6 +41,7 @@ proc build_test_program {} { # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile # Creating a CU with 4-byte addresses lets this test link on # both 32- and 64-bit machines. @@ -48,7 +49,7 @@ proc build_test_program {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C99} - {DW_AT_name dw2-opt-structptr.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels int_label struct_label pointer_label \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp index 1ff7b66587f..8b984c31506 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp @@ -62,7 +62,7 @@ proc run_test { field_name } { cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name dw2-unusual-field-names.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels itype ptype stype diff --git a/gdb/testsuite/gdb.dwarf2/enum-type.exp b/gdb/testsuite/gdb.dwarf2/enum-type.exp index 0b12d19453a..dbb74467170 100644 --- a/gdb/testsuite/gdb.dwarf2/enum-type.exp +++ b/gdb/testsuite/gdb.dwarf2/enum-type.exp @@ -24,10 +24,12 @@ standard_testfile main.c -dw.S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name enum-type-dw.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels integer_label uinteger_label diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp index 0ded2c0e766..82d508a7d83 100644 --- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp +++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp @@ -35,6 +35,8 @@ standard_testfile .S set dwarf_asm [standard_output_file dwarf-asm.S] Dwarf::assemble $dwarf_asm { + global srcfile + declare_labels foo_subprogram bar_subprogram declare_labels stmt_list @@ -43,7 +45,7 @@ Dwarf::assemble $dwarf_asm { cu { addr_size 4 } { DW_TAG_compile_unit { - {DW_AT_name file1.txt} + {DW_AT_name $srcfile} {DW_AT_stmt_list $stmt_list DW_FORM_sec_offset} {DW_AT_language @DW_LANG_C99} {DW_AT_low_pc __cu_low_pc DW_FORM_addr} diff --git a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp index 210acc18641..56fe9d6a67a 100644 --- a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp @@ -28,13 +28,13 @@ standard_testfile main.c -dw.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { - global dwarf_regnum regname + global dwarf_regnum regname srcfile set buf_var [gdb_target_symbol buf] cu {} { DW_TAG_compile_unit { - {DW_AT_name info-locals-optimized-out.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels int_type_label diff --git a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp index e5470ab7cba..ff08c0af5a2 100644 --- a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp +++ b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp @@ -24,10 +24,12 @@ standard_testfile .c -dw.S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_language @DW_LANG_C} - {DW_AT_name main-subprogram.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels type diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp index 920b67a7cb7..06cabc9be7f 100644 --- a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp +++ b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp @@ -42,11 +42,13 @@ standard_testfile void-type.c void-type.S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_producer "GNU C 8.1"} {DW_AT_language @DW_LANG_C} - {DW_AT_name void-type.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels main_type int_type ptr_type diff --git a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp index 71b726f8f6f..20c2daf883f 100644 --- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp +++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp @@ -27,9 +27,11 @@ standard_testfile main.c -dw.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { compile_unit { - {DW_AT_name main.c} + {DW_AT_name $srcfile} } { declare_labels int_type_label char_type_label \ struct_s_label struct_t_label array_a9_label \ diff --git a/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp b/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp index b8a1d64d190..dc91c2f7f39 100644 --- a/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp +++ b/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp @@ -29,11 +29,13 @@ standard_testfile void-type.c .S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_producer "GNU C 8.1"} {DW_AT_language @DW_LANG_C} - {DW_AT_name void-type.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels main_type void_typedef diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp index c0d21ba96b8..82fd5fd4a68 100644 --- a/gdb/testsuite/gdb.dwarf2/var-access.exp +++ b/gdb/testsuite/gdb.dwarf2/var-access.exp @@ -50,13 +50,13 @@ standard_testfile .c -dw.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { - global dwarf_regnum regname + global dwarf_regnum regname srcfile set buf_var [gdb_target_symbol buf] cu {} { DW_TAG_compile_unit { - {DW_AT_name var-pieces-dw.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels char_type_label diff --git a/gdb/testsuite/gdb.dwarf2/void-type.exp b/gdb/testsuite/gdb.dwarf2/void-type.exp index 0ffba34a189..eb8db2c921b 100644 --- a/gdb/testsuite/gdb.dwarf2/void-type.exp +++ b/gdb/testsuite/gdb.dwarf2/void-type.exp @@ -36,11 +36,13 @@ standard_testfile .c .S # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcfile + cu {} { DW_TAG_compile_unit { {DW_AT_producer "Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.5.212 Build 20150212"} {DW_AT_language @DW_LANG_C} - {DW_AT_name void-type.c} + {DW_AT_name $srcfile} {DW_AT_comp_dir /tmp} } { declare_labels int_type void_type ptr_type