From: Tom de Vries Date: Fri, 17 Jul 2020 12:35:44 +0000 (+0200) Subject: [gdb/testsuite] Drop src arg of MACRO_AT_{func,range} X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10da644dc4882fd1e82913da94253fd540d91043;p=binutils-gdb.git [gdb/testsuite] Drop src arg of MACRO_AT_{func,range} 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 * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 76ad9657d45..f9ee61251b2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2020-07-17 Tom de Vries + + * 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 * lib/dwarf.exp (Dwarf::extern): Remove. diff --git a/gdb/testsuite/gdb.dlang/watch-loc.exp b/gdb/testsuite/gdb.dlang/watch-loc.exp index 431f56f01a0..d65f3c674fd 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 68a59f0c71e..8c4365ace69 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 2388ce53f6e..32ae5ed66aa 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 37a9b93c394..d6e309d0d73 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 9f5eda5e381..7be7313ff80 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 8999be3e6cc..d6ce5dfe1dd 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 0e6cc049798..3535be5f532 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 d836baf9298..f289f6100e2 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 59f8bff94aa..86f1c50c4ca 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 b00408b4089..e47d74e95d7 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 7874c8687e3..e270441392e 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 19316ef7eb7..d383b98dd94 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 88539a69763..ad531488409 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 876725be62f..69790e7370e 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 f647f3ca096..d03626a0e8a 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 f745b2ae313..ee625c9f8c8 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