public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Drop src arg of MACRO_AT_{func,range}
@ 2020-07-17 12:36 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-07-17 12:36 UTC (permalink / raw)
  To: gdb-patches

Hi,

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.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Drop src arg of MACRO_AT_{func,range}

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.

---
 gdb/testsuite/gdb.dlang/watch-loc.exp                     |  4 +---
 .../gdb.dwarf2/bitfield-parent-optimized-out.exp          |  4 +---
 gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp          |  6 ++----
 gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp            |  5 ++---
 gdb/testsuite/gdb.dwarf2/dwz.exp                          |  3 +--
 gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp        |  4 +---
 gdb/testsuite/gdb.dwarf2/implref-array.exp                |  4 ++--
 gdb/testsuite/gdb.dwarf2/implref-const.exp                |  4 +---
 gdb/testsuite/gdb.dwarf2/implref-global.exp               |  4 +---
 gdb/testsuite/gdb.dwarf2/implref-struct.exp               |  4 +---
 gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp    |  3 +--
 gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp           |  3 +--
 gdb/testsuite/gdb.dwarf2/var-access.exp                   |  3 +--
 gdb/testsuite/gdb.dwarf2/varval.exp                       |  4 ++--
 gdb/testsuite/gdb.trace/entry-values.exp                  |  2 +-
 gdb/testsuite/lib/dwarf.exp                               | 15 ++++++++-------
 16 files changed, 27 insertions(+), 45 deletions(-)

diff --git a/gdb/testsuite/gdb.dlang/watch-loc.exp b/gdb/testsuite/gdb.dlang/watch-loc.exp
index 431f56f01a..d65f3c674f 100644
--- a/gdb/testsuite/gdb.dlang/watch-loc.exp
+++ b/gdb/testsuite/gdb.dlang/watch-loc.exp
@@ -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}
 		}
 	    }
diff --git a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
index 68a59f0c71..8c4365ace6 100644
--- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
index 2388ce53f6..32ae5ed66a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
@@ -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}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
index 37a9b93c39..d6e309d0d7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
@@ -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}}
 		} {
 		}
 	    }
diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp
index 9f5eda5e38..7be7313ff8 100644
--- a/gdb/testsuite/gdb.dwarf2/dwz.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwz.exp
@@ -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 }}
 	    }
 	}
     }
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
index 8999be3e6c..d6ce5dfe1d 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/implref-array.exp b/gdb/testsuite/gdb.dwarf2/implref-array.exp
index 0e6cc04979..3535be5f53 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-array.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-array.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/implref-const.exp b/gdb/testsuite/gdb.dwarf2/implref-const.exp
index d836baf929..f289f6100e 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-const.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-const.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/implref-global.exp b/gdb/testsuite/gdb.dwarf2/implref-global.exp
index 59f8bff94a..86f1c50c4c 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-global.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-global.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.exp b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
index b00408b408..e47d74e95d 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-struct.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
@@ -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}
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
index 7874c8687e..e270441392 100644
--- a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
@@ -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.
diff --git a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
index 19316ef7eb..d383b98dd9 100644
--- a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
@@ -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 }}
 	    }
 	}
     }
diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp
index 88539a6976..ad53148840 100644
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -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.
diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp
index 876725be62..69790e7370 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.exp
+++ b/gdb/testsuite/gdb.dwarf2/varval.exp
@@ -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}
 		} {
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index f647f3ca09..d03626a0e8 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -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}
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index f745b2ae31..ee625c9f8c 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-17 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 12:36 [committed][gdb/testsuite] Drop src arg of MACRO_AT_{func,range} Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).