diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp | 47 |
2 files changed, 52 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b3a41bd..c188719 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-05-10 Lancelot Six <lsix@lancelotsix.com> + + PR gdb/27614 + * gdb.dwarf2/gdb-add-index-symlink.exp: New test. + 2021-05-10 Andrew Burgess <andrew.burgess@embecosm.com> * gdb.guile/guile.exp: Don't use the source directory as a diff --git a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp new file mode 100644 index 0000000..eaeddec --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp @@ -0,0 +1,47 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +load_lib dwarf.exp + +# This test can only be run on targets which support DWARF-2. +if {![dwarf2_support]} { + return 0 +} + +standard_testfile main.c + +if { [prepare_for_testing "failed to prepare" "${testfile}" \ + [list ${srcfile}]] } { + return -1 +} + +set symlink [file dirname $binfile]/symlink + +if { ![file exists $symlink] } { + file link -symbolic $symlink $binfile +} + +if { [ensure_gdb_index $symlink] == -1 } { + fail "Unable to call gdb-add-index with a symlink to a symfile" + return -1 +} + +# Ok, we have a copy of $binfile with an index. +# Restart gdb and verify the index was used. + +clean_restart $symlink +gdb_test "mt print objfiles ${testfile}" \ + "(gdb_index|debug_names).*" \ + "index used" |