Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / c-linkage-name.exp
CommitLineData
88b9d363 1# Copyright 2018-2022 Free Software Foundation, Inc.
59cc4834
JB
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
16b0db75
TV
17# gdb can correctly print an ada symbol with linkage name before and after
18# symtab expansion.
59cc4834 19
13c3a74a 20standard_testfile c-linkage-name.c c-linkage-name-2.c
59cc4834 21
13c3a74a
TV
22set sources "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}"
23if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } {
59cc4834
JB
24 untested "failed to compile"
25 return -1
26}
27
16b0db75
TV
28clean_restart
29gdb_test_no_output "set language c"
30gdb_load ${binfile}
c0502da6 31set readnow [readnow]
13c3a74a 32
16b0db75
TV
33set test "verify no symtab expansion"
34if { $readnow } {
35 unsupported $test
36} else {
37 # Verify that symtab expansion has not taken place.
13c3a74a 38
16b0db75
TV
39 gdb_test_no_output "maint info symtabs" $test
40}
13c3a74a 41
c0502da6
TV
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.
59cc4834 47
c0502da6 48 gdb_test "print symada__cS" \
bcfe6157
TT
49 " = {a = 100829103}" \
50 "print symada__cS before partial symtab expansion"
c0502da6 51}
59cc4834
JB
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
13c3a74a
TV
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
16b0db75 63gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*"
13c3a74a
TV
64
65# Flush the symbol cache to prevent the lookup to return the same as before.
66
50a5f187 67gdb_test "maint flush symbol-cache"
59cc4834
JB
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"
This page took 0.537458 seconds and 4 git commands to generate.