Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / c-linkage-name.exp
1 # Copyright 2018-2022 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
20 standard_testfile c-linkage-name.c c-linkage-name-2.c
21
22 set sources "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}"
23 if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } {
24 untested "failed to compile"
25 return -1
26 }
27
28 clean_restart
29 gdb_test_no_output "set language c"
30 gdb_load ${binfile}
31 set readnow [readnow]
32
33 set test "verify no symtab expansion"
34 if { $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
42 set test "print symada__cS before partial symtab expansion"
43 if { $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
57 gdb_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
63 gdb_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
67 gdb_test "maint flush symbol-cache"
68
69 # Try to print MUNDANE using its linkage name again, after partial
70 # symtab expansion.
71
72 gdb_test "print symada__cS" \
73 " = {a = 100829103}" \
74 "print symada__cS after partial symtab expansion"
This page took 0.033018 seconds and 4 git commands to generate.