[gdb/testsuite] Use $srcfile in DW_AT_name for CU
authorTom de Vries <tdevries@suse.de>
Fri, 23 Oct 2020 12:55:04 +0000 (14:55 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 23 Oct 2020 12:55:04 +0000 (14:55 +0200)
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  <tdevries@suse.de>

* 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.

21 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp
gdb/testsuite/gdb.dwarf2/atomic-type.exp
gdb/testsuite/gdb.dwarf2/bad-regnum.exp
gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
gdb/testsuite/gdb.dwarf2/dw2-align.exp
gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp
gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp
gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp
gdb/testsuite/gdb.dwarf2/enum-type.exp
gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
gdb/testsuite/gdb.dwarf2/main-subprogram.exp
gdb/testsuite/gdb.dwarf2/missing-type-name.exp
gdb/testsuite/gdb.dwarf2/nonvar-access.exp
gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp
gdb/testsuite/gdb.dwarf2/var-access.exp
gdb/testsuite/gdb.dwarf2/void-type.exp

index f75c7327863980c3f34239d1ad50eb2c5de2cc17..2683237a34f832da2b2c56bf83565841ca106a85 100644 (file)
@@ -1,3 +1,26 @@
+2020-10-23  Tom de Vries  <tdevries@suse.de>
+
+       * 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  <simon.marchi@polymtl.ca>
 
        PR gdb/26693
index 0b440c8e6daf8a3a7023fabda8d778aa6b5ca562..870a7550f0824972f1c8c982cae7df76eba7be9a 100644 (file)
@@ -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}
 
         } {
index d28af05d26e73d52c3fb157ff819458ee01e8939..1058d2db9ced3413fd6b6dfcd66648652a6be7c7 100644 (file)
@@ -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
index acd739f7a5090d79ffebe7e8b3b3e4d40d779af7..600ec56a720af406956d954715b7241286313a47 100644 (file)
@@ -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
index f2c88b9b553dea1f96924f92591dee98960ac43e..a1077b5a8259e0e1e6d312e1d7ef309095810701 100644 (file)
@@ -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}
 
        } {
index 640216ae19213d19fe6a117e9b4b5d09baea6693..4ad4fe811cf7195b59b5a067f1e2a28a15081283 100644 (file)
@@ -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
index a85d3430a75b823a8ba43ac8f5f99aae89e5cd52..e939046e9613e95b45e4fc3e92f11cfb0e5bea3c 100644 (file)
@@ -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}
index 238297c76ae6e7cdfd6f6c7c9d2830bf7bbc7339..bfb95215eb845c965d4cebfd12224da95783ac95 100644 (file)
@@ -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}
 
         } {
index 44d5faa97bdfc609bfe3308a699b7d69ad66ab70..e93f2ce938d0d9881c519622dd5da83251282c15 100644 (file)
@@ -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
index a6d9a500287d45be982993c006b44d271ceff7b9..bba05e4d5c3aeff026d9d374a11fb35a00d02662 100644 (file)
@@ -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
index 496eddcc8618bf5de50d064c5e9c28e532926293..332e8439eb08f932969364ad63bcac7be200cd2f 100644 (file)
@@ -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 \
index 1ff7b66587f8aa213d4ba13f508aa6e5f5699c99..8b984c31506e5c16f810152d673dcefbdfe17d67 100644 (file)
@@ -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
index 0b12d19453aa8e7e2c504964735e5f28ee80491f..dbb74467170f7e47d8f42b5af45aaefd1175a14e 100644 (file)
@@ -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
index 0ded2c0e766924198244effc813cfa2c68a78214..82d508a7d8360fd2381f486b0edc1a565e72828d 100644 (file)
@@ -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}
index 210acc1864173110de4a3da6612563164ce86020..56fe9d6a67a434ff37a1a64cccabd715caa638a1 100644 (file)
@@ -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
index e5470ab7cba494bb70f23c42218256eca5f9728f..ff08c0af5a2734c664069bd79164fb14bc246d2e 100644 (file)
@@ -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
index 920b67a7cb740ae3f20aecc95351e7357b3f5070..06cabc9be7fea40b158720a0c19f0dbfbfb1aa54 100644 (file)
@@ -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
index 71b726f8f6f5ccead2cda2565ecf6498734054dd..20c2daf883fae4930aad3b9362584baa9747ce9b 100644 (file)
@@ -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 \
index b8a1d64d1909d6097c54b0623026275f60043204..dc91c2f7f3990b565b2c3f3ce3af7b48c92f3f7b 100644 (file)
@@ -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
index c0d21ba96b80eb7148dabd4d088dbffaa3a67748..82fd5fd4a68f8457cf5491fa03853d76bda22c4b 100644 (file)
@@ -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
index 0ffba34a189c0f87626c8241220da32edbfed672..eb8db2c921b35e5c86392a37c90d7793248b3294 100644 (file)
@@ -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