diff options
author | Gary Benson <gbenson@redhat.com> | 2020-10-21 09:54:31 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2020-10-21 09:54:31 +0100 |
commit | 98cec4f6a27679709d7ae2ce7ee25af50866f604 (patch) | |
tree | 8f1b06c93e883f2ebd8f86b5b5d4a4800d534372 /gdb | |
parent | a1bd8917ab2bbb61071366ce8a6fd31d00d147ad (diff) | |
download | binutils-gdb-98cec4f6a27679709d7ae2ce7ee25af50866f604.tar.gz |
Fix gdb.mi/mi-fullname-deleted.exp with Clang
gdb.mi/mi-fullname-deleted.exp attempts to generate an executable
with a doubled slash in the source filename recorded in its debug
info. This attempt fails when compiling using Clang, causing the
substituted filename test to fail. This commit fixes this issue.
It also expands the comments in the file, to clarify what the test
is attempting to do, and to document where it doesn't succeed.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-fullname-deleted.exp: Fix substituted
fullname test with Clang. Also expand comments generally.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-fullname-deleted.exp | 26 |
2 files changed, 27 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 277848c2532..4061d1789cc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-10-21 Gary Benson <gbenson@redhat.com> + + * gdb.mi/mi-fullname-deleted.exp: Fix substituted + fullname test with Clang. Also expand comments generally. + 2020-10-20 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/pr13961.S: Remove superfluous end-of-siblings marker. diff --git a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp index f68bcc55bc3..e175041b46c 100644 --- a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp @@ -24,7 +24,17 @@ if [mi_gdb_start] { standard_testfile set srcfileabs [standard_output_file $srcfile] -# "//$srcfile" It is used for the test of compare_filenames_for_search. +# Double the final slash separator in $srcfileabs, such that +# "/path/to/$srcfile" becomes "/path/to//$srcfile". This is +# passed as the "source" argument of gdb_compile, which, when +# using GCC (as of 10.2) will result in the doubled slash +# being incorporated into the built executable's debug info. +# This is then used to check compare_filenames_for_search does +# not falsely use an absolute filename as a relative one. +# Note that Clang (as of 12.0.0) normalizes the path before +# storing it in the executable's debug info, removing the double +# slash. This nullifies the "compare_filenames_for_search does +# not match" test when using Clang (it can never fail). if { [regsub {/[^/]+$} $srcfileabs {/\0} srcfileabs] != 1 } { xfail "cannot double the last slash separator" return -1 @@ -36,6 +46,12 @@ if { [regsub {^(/[^/]+)/} $srcfileabs {\1subst/} srcfileabssubst] != 1 return -1 } +# Generate a regular expression which to match $srcfileabs with +# or without the doubled slash. This is used by the substituted +# fullname test. +set srcfileabssubst_regexp [string_to_regexp $srcfileabssubst] +regsub {//} $srcfileabssubst_regexp {\0?} srcfileabssubst_regexp + set f [open $srcfileabs "w"] puts $f "int main (void) { return 0; }" close $f @@ -54,10 +70,12 @@ mi_gdb_test "-interpreter-exec console \"set substitute-path ${initdir} ${initdi mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\".*\".*" "fullname present" -mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\"[string_to_regexp $srcfileabssubst]\".*" "substituted fullname" +mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\"$srcfileabssubst_regexp\".*" "substituted fullname" -# Test compare_filenames_for_search does not falsely use absolute filename as -# a relative one. +# Test compare_filenames_for_search does not falsely use absolute +# filename as a relative one. Note that this test can falsely pass +# with Clang, and possibly other compilers too; see the comment +# above for more. mi_gdb_test "-break-insert -t /$srcfile:main" \ "\\^error,msg=\"No source file named /[string_to_regexp $srcfile]\\.\"" \ "compare_filenames_for_search does not match" |