diff options
author | Tom de Vries <tdevries@suse.de> | 2021-11-29 09:51:10 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-11-29 09:51:10 +0100 |
commit | 2a0fa84217cc3ec874f2f924510c7543358bca9c (patch) | |
tree | 21a62e3174dfa532b8f70b1deb130edba6e5f33a | |
parent | 97b3f4e86f7a25e0767487d72cb3977fd653b5bc (diff) | |
download | gdb-2a0fa84217cc3ec874f2f924510c7543358bca9c.zip gdb-2a0fa84217cc3ec874f2f924510c7543358bca9c.tar.gz gdb-2a0fa84217cc3ec874f2f924510c7543358bca9c.tar.bz2 |
[gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp
While debugging a problem in gdb.dwarf2/dw2-lines.exp, I realized that the
test-case generates all executables and associated temporary files using the
same filenames.
Fix this by adding a new proc prefix_id in lib/gdb.exp, and using it in the
test-case.
Tested on x86_64-linux.
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 26 |
2 files changed, 30 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp index 9cc2495..09b6052 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp @@ -20,7 +20,7 @@ load_lib dwarf.exp # This test can only be run on targets which support DWARF-2 and use gas. require dwarf2_support 1 -standard_testfile .c -dw.S +standard_testfile .c with_shared_gdb { set func_info_vars \ @@ -46,6 +46,8 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} { set ldw64 $_ldw64 set string_form $_string_form + standard_testfile .c [prefix_id]-dw.S + set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { declare_labels Llines @@ -103,7 +105,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} { } } - if { [prepare_for_testing "failed to prepare" ${testfile} \ + if { [prepare_for_testing "failed to prepare" ${testfile}.[prefix_id] \ [list $srcfile $asm_file] {nodebug}] } { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 77f889e..b145fe8 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2498,6 +2498,32 @@ proc proc_with_prefix {name arguments body} { proc $name $arguments [list with_test_prefix $name $body] } +# Return an id corresponding to the test prefix stored in $pf_prefix, which +# is more suitable for use in a file name. +# F.i., for a pf_prefix: +# gdb.dwarf2/dw2-lines.exp: \ +# cv=5: cdw=64: lv=5: ldw=64: string_form=line_strp: +# return an id: +# cv-5-cdw-32-lv-5-ldw-64-string_form-line_strp + +proc prefix_id {} { + global pf_prefix + set id $pf_prefix + + # Strip ".exp: " prefix. + set id [regsub {.*\.exp: } $id {}] + + # Strip colon suffix. + set id [regsub {:$} $id {}] + + # Strip spaces. + set id [regsub -all { } $id {}] + + # Replace colons, equal signs. + set id [regsub -all \[:=\] $id -] + + return $id +} # Run BODY in the context of the caller. After BODY is run, the variables # listed in VARS will be reset to the values they had before BODY was run. |