dw2-linkage-name-trust.exp revision 1.9
150397Sobrien# Copyright 2011-2020 Free Software Foundation, Inc.
290075Sobrien
390075Sobrien# This program is free software; you can redistribute it and/or modify
450397Sobrien# it under the terms of the GNU General Public License as published by
550397Sobrien# the Free Software Foundation; either version 3 of the License, or
690075Sobrien# (at your option) any later version.
750397Sobrien#
890075Sobrien# This program is distributed in the hope that it will be useful,
990075Sobrien# but WITHOUT ANY WARRANTY; without even the implied warranty of
1090075Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1190075Sobrien# GNU General Public License for more details.
1250397Sobrien#
1390075Sobrien# You should have received a copy of the GNU General Public License
1490075Sobrien# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1590075Sobrien
1690075Sobrien# Check that GDB can call C++ functions whose parameters or return values have
1750397Sobrien# type containing a static member of the same type.
1850397Sobrien
1990075Sobrien# Still no C++ compiler is used.
2090075Sobrienif { [skip_cplus_tests] } { continue }
2190075Sobrien
2250397Sobrienload_lib dwarf.exp
2350397Sobrien# This test can only be run on targets which support DWARF-2 and use gas.
2450397Sobrienif {![dwarf2_support]} {
2550397Sobrien    return 0
2650397Sobrien}
2750397Sobrien
2850397Sobrienstandard_testfile .S
2950397Sobrienset executable ${testfile}
3050397Sobrien
3150397Sobrienif {[prepare_for_testing_full "failed to prepare" \
3250397Sobrien	 [list $testfile c++ $testfile-main.cc {c++ debug} \
3350397Sobrien	      $srcfile {}]]} {
3450397Sobrien    return -1
3550397Sobrien}
3650397Sobrien
3750397Sobrienif ![runto_main] then {
3850397Sobrien    return -1
3950397Sobrien}
4050397Sobrien
4150397Sobrien# main is not provided by DWARF.
4250397Sobriengdb_test_no_output "set language c++"
4350397Sobrien
4450397Sobrien# There are no mangled names in DWARF to suggest the v3 ABI.
4550397Sobriengdb_test_no_output "set cp-abi gnu-v3"
4650397Sobrien
4790075Sobrien# GDB cannot resolve external member function for which only ELF (and not
4850397Sobrien# DWARF) symbol is available.  Therefore the function `f' must have DWARF which
4950397Sobrien# confuses it a bit.
5090075Sobrien
5190075Sobriengdb_test "p c.membername" " = {.*} 0x\[0-9a-f\]+ <f\\(\\)>"
5290075Sobriengdb_breakpoint "C::membername"
5390075Sobriengdb_test "p c.membername ()" "\r\nBreakpoint \[0-9\]+, .*"
5490075Sobrien