[gdb/testsuite] Drop src arg of MACRO_AT_{func,range}
authorTom de Vries <tdevries@suse.de>
Fri, 17 Jul 2020 12:35:44 +0000 (14:35 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 17 Jul 2020 12:35:44 +0000 (14:35 +0200)
The dwarf assembly procs MACRO_AT_func and MACRO_AT_range have a src
parameter, which is set to $srcdir/$subdir/$srcfile in every single call.

Drop the src parameter and hardcode usage of $srcdir/$subdir/$srcfile in the
procs.

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-17  Tom de Vries  <tdevries@suse.de>

* lib/dwarf.exp (Dwarf::MACRO_AT_func, Dwarf::MACRO_AT_range): Drop
src parameter.
* gdb.dlang/watch-loc.exp: Update MACRO_AT_{func,range} calls.
* gdb.dwarf2/bitfield-parent-optimized-out.exp: Same.
* gdb.dwarf2/dw2-ifort-parameter.exp: Same.
* gdb.dwarf2/dw2-opt-structptr.exp: Same.
* gdb.dwarf2/dwz.exp: Same.
* gdb.dwarf2/implptr-optimized-out.exp: Same.
* gdb.dwarf2/implref-array.exp: Same.
* gdb.dwarf2/implref-const.exp: Same.
* gdb.dwarf2/implref-global.exp: Same.
* gdb.dwarf2/implref-struct.exp: Same.
* gdb.dwarf2/info-locals-optimized-out.exp: Same.
* gdb.dwarf2/opaque-type-lookup.exp: Same.
* gdb.dwarf2/var-access.exp: Same.
* gdb.dwarf2/varval.exp: Same.
* gdb.trace/entry-values.exp: Same.

17 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dlang/watch-loc.exp
gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
gdb/testsuite/gdb.dwarf2/dwz.exp
gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
gdb/testsuite/gdb.dwarf2/implref-array.exp
gdb/testsuite/gdb.dwarf2/implref-const.exp
gdb/testsuite/gdb.dwarf2/implref-global.exp
gdb/testsuite/gdb.dwarf2/implref-struct.exp
gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
gdb/testsuite/gdb.dwarf2/var-access.exp
gdb/testsuite/gdb.dwarf2/varval.exp
gdb/testsuite/gdb.trace/entry-values.exp
gdb/testsuite/lib/dwarf.exp

index 76ad9657d45bb797421123ba8beda884847b3c54..f9ee61251b2cdfbebd1e3ac6150242f4f600d544 100644 (file)
@@ -1,3 +1,23 @@
+2020-07-17  Tom de Vries  <tdevries@suse.de>
+
+       * lib/dwarf.exp (Dwarf::MACRO_AT_func, Dwarf::MACRO_AT_range): Drop
+       src parameter.
+       * gdb.dlang/watch-loc.exp: Update MACRO_AT_{func,range} calls.
+       * gdb.dwarf2/bitfield-parent-optimized-out.exp: Same.
+       * gdb.dwarf2/dw2-ifort-parameter.exp: Same.
+       * gdb.dwarf2/dw2-opt-structptr.exp: Same.
+       * gdb.dwarf2/dwz.exp: Same.
+       * gdb.dwarf2/implptr-optimized-out.exp: Same.
+       * gdb.dwarf2/implref-array.exp: Same.
+       * gdb.dwarf2/implref-const.exp: Same.
+       * gdb.dwarf2/implref-global.exp: Same.
+       * gdb.dwarf2/implref-struct.exp: Same.
+       * gdb.dwarf2/info-locals-optimized-out.exp: Same.
+       * gdb.dwarf2/opaque-type-lookup.exp: Same.
+       * gdb.dwarf2/var-access.exp: Same.
+       * gdb.dwarf2/varval.exp: Same.
+       * gdb.trace/entry-values.exp: Same.
+
 2020-07-17  Tom de Vries  <tdevries@suse.de>
 
        * lib/dwarf.exp (Dwarf::extern): Remove.
index 431f56f01a0bdfa491530ffba8048c663ada1100..d65f3c674fdac1f9a919b2d03dbc772ef49da126 100644 (file)
@@ -30,8 +30,6 @@ standard_testfile watch-loc.c watch-loc-dw.S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
     cu {} {
        compile_unit {
            {language @DW_LANG_D}
@@ -56,7 +54,7 @@ Dwarf::assemble $asm_file {
                }
 
                subprogram {
-                   {MACRO_AT_func { "_Dmain" "${srcdir}/${subdir}/${srcfile}" }}
+                   {MACRO_AT_func { "_Dmain" }}
                    {external 1 flag_present}
                }
            }
index 68a59f0c71e4d621a02fb5dff9666dfd50d93fdd..8c4365ace69069833e060bcf2f3d07c649477643 100644 (file)
@@ -29,8 +29,6 @@ set executable ${testfile}
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
     cu { version 3 addr_size 4 } {
        compile_unit {} {
            declare_labels struct_label var_label int_label
@@ -59,7 +57,7 @@ Dwarf::assemble $asm_file {
            }
 
            subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
                {type :$int_label}
                {external 1 flag}
            } {
index 2388ce53f6ed28253f4f92bf455fa349eb0772b7..32ae5ed66aad492a8e8e702e66fcb520ae8455d3 100644 (file)
@@ -29,13 +29,11 @@ set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
     declare_labels int_label
 
-    global srcdir subdir srcfile
-
     cu {} {
        compile_unit {
            {name file1.txt}
            {language @DW_LANG_C}
-           {MACRO_AT_range { func ${srcdir}/${subdir}/${srcfile} }}
+           {MACRO_AT_range { func }}
        } {
            int_label: base_type {
                {name int}
@@ -45,7 +43,7 @@ Dwarf::assemble $asm_file {
 
            subprogram {
                {external 1 flag}
-               {MACRO_AT_func { func ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { func }}
            } {
                formal_parameter {
                    {name param}
index 37a9b93c394593db873a1a68bbcc7830bf596e20..d6e309d0d73b2c53c6ccfeaa06bd29b0f167939f 100644 (file)
@@ -41,7 +41,6 @@ proc build_test_program {} {
     # Make some DWARF for the test.
     set asm_file [standard_output_file $srcfile2]
     Dwarf::assemble $asm_file {
-        global srcdir subdir srcfile
 
        # Creating a CU with 4-byte addresses lets this test link on
        # both 32- and 64-bit machines.
@@ -102,7 +101,7 @@ proc build_test_program {} {
                    {DW_AT_name func01}
                    {DW_AT_type :$int_label}
                    {external   1 flag}
-                   {MACRO_AT_func {func01 ${srcdir}/${subdir}/${srcfile}}}
+                   {MACRO_AT_func {func01}}
                } {
                    DW_TAG_variable {
                        {DW_AT_name ptr}
@@ -115,7 +114,7 @@ proc build_test_program {} {
                    {DW_AT_name main}
                    {DW_AT_type :$int_label}
                    {external   1 flag}
-                   {MACRO_AT_func {main ${srcdir}/${subdir}/${srcfile}}}
+                   {MACRO_AT_func {main}}
                } {
                }
            }
index 9f5eda5e381165824f6b4c0c430a0c892029008d..7be7313ff806b4325bbf58abc1998cb8f33b02b3 100644 (file)
@@ -26,12 +26,11 @@ standard_testfile main.c dwz.S
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
     declare_labels partial_label int_label int_label2
-    global srcdir subdir srcfile
 
     cu {} {
        partial_label: partial_unit {} {
            subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
            }
        }
     }
index 8999be3e6cc9a2a823dd31ca1b4266f3b1f13184..d6ce5dfe1ddbad17cd1b6f26fa59d1a1a6166f0c 100644 (file)
@@ -25,8 +25,6 @@ set executable ${testfile}
 # Create the DWARF.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
     cu { version 3 addr_size 4 } {
        compile_unit {
            {producer "GNU C 4.4.3"}
@@ -53,7 +51,7 @@ Dwarf::assemble $asm_file {
            }
 
            subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
                {type :$int_label}
                {external 1 flag}
            } {
index 0e6cc04979874fd05ceee9a1f977e404934fb605..3535be5f5328c926c08358e98f0a2c325a7edcad 100644 (file)
@@ -51,7 +51,7 @@ set array_length [get_valueof "/u" "sizeof(array) / sizeof(array\[0\])" -1]
 # The variable must be global so that its name is an exported symbol that we
 # can reference from the DWARF using gdb_target_symbol.
 Dwarf::assemble ${asm_file} {
-    global srcdir subdir srcfile array_length
+    global array_length
 
     cu {} {
        DW_TAG_compile_unit {
@@ -99,7 +99,7 @@ Dwarf::assemble ${asm_file} {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+               {MACRO_AT_func { "main" }}
                {DW_AT_type :${int_label}}
                {DW_AT_external 1 DW_FORM_flag}
            } {
index d836baf9298bbae3ee546b6b8405d156fad09dd0..f289f6100e2f728310fa3b4c523058ec714372a7 100644 (file)
@@ -47,8 +47,6 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
 # Create the DWARF.  We need a regular variable and a reference to it that'll
 # be marked with DW_OP_GNU_implicit_pointer.
 Dwarf::assemble ${asm_file} {
-    global srcdir subdir srcfile
-
     cu {} {
        DW_TAG_compile_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
@@ -76,7 +74,7 @@ Dwarf::assemble ${asm_file} {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+               {MACRO_AT_func { "main" }}
                {DW_AT_type :${int_label}}
                {DW_AT_external 1 DW_FORM_flag}
            } {
index 59f8bff94aa09bafe36055c17e9279baaf216f48..86f1c50c4ca6b7d72ab0cc4578f3f676a1280cb7 100644 (file)
@@ -49,8 +49,6 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
 # that its name is an exported symbol that we can reference from the DWARF
 # using gdb_target_symbol.
 Dwarf::assemble ${asm_file} {
-    global srcdir subdir srcfile
-
     cu {} {
        DW_TAG_compile_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
@@ -80,7 +78,7 @@ Dwarf::assemble ${asm_file} {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+               {MACRO_AT_func { "main" }}
                {DW_AT_type :${int_label}}
                {DW_AT_external 1 DW_FORM_flag}
            } {
index b00408b4089b400c7ffcc8908730dde6bb22b21f..e47d74e95d7dd662e05047bfbc8b7f4aef7e2e84 100644 (file)
@@ -49,8 +49,6 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]
 # global so that its name is an exported symbol that can we can reference from
 # the DWARF using gdb_target_symbol.
 Dwarf::assemble ${asm_file} {
-    global srcdir subdir srcfile
-
     cu {} {
        DW_TAG_compile_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
@@ -115,7 +113,7 @@ Dwarf::assemble ${asm_file} {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+               {MACRO_AT_func { "main" }}
                {DW_AT_type :${int_label}}
                {DW_AT_external 1 DW_FORM_flag}
            } {
index 7874c8687e36c38a57ea248e92bae7d05d0752f8..e270441392e05a124045f14a325c31f0f7869513 100644 (file)
@@ -28,7 +28,6 @@ standard_testfile .c ${gdb_test_file_name}-dw.S
 
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
     global dwarf_regnum regname
 
     set buf_var [gdb_target_symbol buf]
@@ -48,7 +47,7 @@ Dwarf::assemble $asm_file {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
                {DW_AT_external 1 flag}
            } {
                # A variable completely optimized out.
index 19316ef7eb7e0f6053bc6f25719e636d4f4d14df..d383b98dd94d19f9aff59feeac4a20ae0203d8ec 100644 (file)
@@ -32,7 +32,6 @@ Dwarf::assemble $asm_file {
     declare_labels struct_a_label struct_b_label
     declare_labels opaque_struct_a_label opaque_struct_b_label
     declare_labels char_type1_label char_type2_label
-    global srcdir subdir srcfile
 
     # The partial units are laid out so we're not dependent on the order that
     # they appear in compunit_symtab.includes.  We need the one with the
@@ -180,7 +179,7 @@ Dwarf::assemble $asm_file {
            {name main}
        } {
            subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
            }
        }
     }
index 88539a69763009e80bbe3668926bf349d3bfb329..ad531488409a0d614c236f78d1674fb2e997ddd2 100644 (file)
@@ -50,7 +50,6 @@ standard_testfile .c ${gdb_test_file_name}-dw.S
 
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
     global dwarf_regnum regname
 
     set buf_var [gdb_target_symbol buf]
@@ -162,7 +161,7 @@ Dwarf::assemble $asm_file {
            }
 
            DW_TAG_subprogram {
-               {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { main }}
                {DW_AT_external 1 flag}
            } {
                # Simple memory location.
index 876725be62f4d60cc4168c424ee223dab5babb7d..69790e7370e443961ff9df2776809fa21a2c4a08 100644 (file)
@@ -48,7 +48,7 @@ proc setup_exec { arg_bad } {
 
     # Create the DWARF.  
     Dwarf::assemble ${asm_file} {
-       global srcdir subdir srcfile bad int_size addr_size
+       global bad int_size addr_size
 
        cu {} {
            DW_TAG_compile_unit {
@@ -198,7 +198,7 @@ proc setup_exec { arg_bad } {
                }
 
                DW_TAG_subprogram {
-                   {MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+                   {MACRO_AT_func { "main" }}
                    {DW_AT_type :${int_label}}
                    {DW_AT_external 1 DW_FORM_flag}
                } {
index f647f3ca096d1a59e0beaea34e25774c334f6f3b..d03626a0e8a27bdb537822c6507884cea531aab7 100644 (file)
@@ -108,7 +108,7 @@ Dwarf::assemble $asm_file {
 
            foo_label: subprogram {
                {decl_file 0 udata}
-               {MACRO_AT_func { foo ${srcdir}/${subdir}/${srcfile} }}
+               {MACRO_AT_func { foo }}
            } {
                formal_parameter {
                    {type :$int_label}
index f745b2ae313845a6114ea8ca097958072314575a..ee625c9f8c86e3417d4fc4465bc54aa82ee5ffa5 100644 (file)
@@ -219,11 +219,11 @@ proc get_func_info { name {options {debug}} } {
 # which will be substituted by one or more standard or macro attributes.
 # supported macro attributes are:
 #
-#  - MACRO_AT_range { FUNC FILE }
+#  - MACRO_AT_range { FUNC }
 #  It is substituted by DW_AT_low_pc and DW_AT_high_pc with the start and
-#  end address of function FUNC in file FILE.
+#  end address of function FUNC in file $srcdir/$subdir/$srcfile.
 #
-#  - MACRO_AT_func { FUNC FILE }
+#  - MACRO_AT_func { FUNC }
 #  It is substituted by DW_AT_name with FUNC and MACRO_AT_range.
 #
 # If FORM is given, it should name a DW_FORM_ constant.
@@ -621,12 +621,13 @@ namespace eval Dwarf {
     # Handle macro attribute MACRO_AT_range.
 
     proc _handle_macro_at_range { attr_value } {
-       if {[llength $attr_value] != 2} {
-           error "usage: MACRO_AT_range { func file }"
+       if {[llength $attr_value] != 1} {
+           error "usage: MACRO_AT_range { func }"
        }
 
        set func [lindex $attr_value 0]
-       set src [lindex $attr_value 1]
+       global srcdir subdir srcfile
+       set src ${srcdir}/${subdir}/${srcfile}
        set result [function_range $func $src]
 
        _handle_attribute DW_AT_low_pc [lindex $result 0] \
@@ -638,7 +639,7 @@ namespace eval Dwarf {
     # Handle macro attribute MACRO_AT_func.
 
     proc _handle_macro_at_func { attr_value } {
-       if {[llength $attr_value] != 2} {
+       if {[llength $attr_value] != 1} {
            error "usage: MACRO_AT_func { func file }"
        }
        _handle_attribute DW_AT_name [lindex $attr_value 0] DW_FORM_string