Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2018-2020 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 | |
17 | # gdb can correctly print arrays with indexes for each element of the | |
18 | # array. | |
19 | ||
13c3a74a | 20 | standard_testfile c-linkage-name.c c-linkage-name-2.c |
59cc4834 | 21 | |
13c3a74a TV |
22 | set sources "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" |
23 | if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } { | |
59cc4834 JB |
24 | untested "failed to compile" |
25 | return -1 | |
26 | } | |
27 | ||
28 | clean_restart ${binfile} | |
29 | ||
13c3a74a TV |
30 | # Verify that partial symtab expansion for $filename has state $readin |
31 | ||
32 | proc verify_psymtab_expanded { filename readin } { | |
33 | set cmd "maint info psymtab" | |
34 | set test "$cmd: $filename: $readin" | |
35 | set re [multi_line \ | |
36 | " \{ psymtab \[^\r\n\]*$filename\[^\r\n\]*" \ | |
37 | " readin $readin" \ | |
38 | ".*"] | |
39 | ||
40 | gdb_test $cmd $re $test | |
41 | } | |
42 | ||
43 | # Verify that partial symtab expansion has not taken place for | |
44 | # c-linkage-name-2.c. | |
45 | ||
46 | verify_psymtab_expanded c-linkage-name-2.c no | |
47 | ||
59cc4834 JB |
48 | # Try to print MUNDANE, but using its linkage name. |
49 | ||
50 | gdb_test "print symada__cS" \ | |
13c3a74a | 51 | "'symada__cS' has unknown type; cast it to its declared type" \ |
59cc4834 JB |
52 | "print symada__cS before partial symtab expansion" |
53 | ||
54 | # Force the symbols to be expanded for the unit that contains | |
55 | # our symada__cS symbol by, e.g. inserting a breakpoint on one | |
56 | # of the founction also provided by the same using. | |
57 | ||
13c3a74a TV |
58 | gdb_test "break do_something_other_cu" \ |
59 | "Breakpoint $decimal at $hex: file .*$srcfile2, line $decimal\\." | |
60 | ||
61 | # Verify that partial symtab expansion has taken place for | |
62 | # c-linkage-name-2.c. | |
63 | ||
64 | verify_psymtab_expanded c-linkage-name-2.c yes | |
65 | ||
66 | # Flush the symbol cache to prevent the lookup to return the same as before. | |
67 | ||
68 | gdb_test "maint flush-symbol-cache" | |
59cc4834 JB |
69 | |
70 | # Try to print MUNDANE using its linkage name again, after partial | |
71 | # symtab expansion. | |
72 | ||
73 | gdb_test "print symada__cS" \ | |
74 | " = {a = 100829103}" \ | |
75 | "print symada__cS after partial symtab expansion" |