1# Copyright 2018-2020 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16# This file is part of the gdb testsuite. It is intended to test that 17# gdb can correctly print an ada symbol with linkage name before and after 18# symtab expansion. 19 20standard_testfile c-linkage-name.c c-linkage-name-2.c 21 22set sources "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" 23if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } { 24 untested "failed to compile" 25 return -1 26} 27 28clean_restart 29gdb_test_no_output "set language c" 30gdb_load ${binfile} 31set readnow [readnow] 32 33set test "verify no symtab expansion" 34if { $readnow } { 35 unsupported $test 36} else { 37 # Verify that symtab expansion has not taken place. 38 39 gdb_test_no_output "maint info symtabs" $test 40} 41 42set test "print symada__cS before partial symtab expansion" 43if { $readnow } { 44 unsupported $test 45} else { 46 # Try to print MUNDANE, but using its linkage name. 47 48 gdb_test "print symada__cS" \ 49 " = {a = 100829103}" \ 50 "print symada__cS before partial symtab expansion" 51} 52 53# Force the symbols to be expanded for the unit that contains 54# our symada__cS symbol by, e.g. inserting a breakpoint on one 55# of the founction also provided by the same using. 56 57gdb_test "break do_something_other_cu" \ 58 "Breakpoint $decimal at $hex: file .*$srcfile2, line $decimal\\." 59 60# Verify that partial symtab expansion has taken place for 61# c-linkage-name-2.c. 62 63gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*" 64 65# Flush the symbol cache to prevent the lookup to return the same as before. 66 67gdb_test "maint flush-symbol-cache" 68 69# Try to print MUNDANE using its linkage name again, after partial 70# symtab expansion. 71 72gdb_test "print symada__cS" \ 73 " = {a = 100829103}" \ 74 "print symada__cS after partial symtab expansion" 75