Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2016-2022 Free Software Foundation, Inc. |
97cbe998 SDJ |
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 | standard_testfile .c | |
17 | ||
18 | if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } { | |
812cd6eb | 19 | untested "couldn't compile ${srcfile}" |
97cbe998 SDJ |
20 | return -1 |
21 | } | |
22 | ||
96038148 TV |
23 | # See if we have target board readnow.exp or similar. |
24 | if { [lsearch -exact $GDBFLAGS -readnow] != -1 \ | |
25 | || [lsearch -exact $GDBFLAGS --readnow] != -1 } { | |
26 | untested "--readnever not allowed in combination with --readnow" | |
27 | return -1 | |
28 | } | |
29 | ||
97cbe998 SDJ |
30 | save_vars { GDBFLAGS } { |
31 | append GDBFLAGS " --readnever" | |
2016d3e6 TV |
32 | if { [clean_restart ${binfile}] == -1 } { |
33 | return -1 | |
34 | } | |
97cbe998 SDJ |
35 | } |
36 | ||
37 | if ![runto_main] then { | |
38 | perror "couldn't run to breakpoint" | |
39 | continue | |
40 | } | |
41 | ||
42 | gdb_test "break fun_three" \ | |
43 | "Breakpoint $decimal at $hex" | |
44 | ||
45 | gdb_test "continue" \ | |
46 | "Breakpoint $decimal, $hex in fun_three \\(\\)" | |
47 | ||
48 | gdb_test "backtrace" \ | |
49 | [multi_line "#0 $hex in fun_three \\(\\)" \ | |
50 | "#1 $hex in fun_two \\(\\)" \ | |
51 | "#2 $hex in fun_one \\(\\)" \ | |
52 | "#3 $hex in main \\(\\)" ] | |
53 | ||
54 | gdb_test_no_output "maint info symtabs" \ | |
55 | "maint info symtabs no output for --readnever" | |
56 | gdb_test_no_output "maint info psymtabs" \ | |
57 | "maint info psymtabs no output for --readnever" | |
58 | ||
59 | # Test invalid combination of flags. | |
60 | save_vars { GDBFLAGS } { | |
61 | append GDBFLAGS " --readnever --readnow" | |
62 | gdb_exit | |
63 | gdb_spawn | |
64 | ||
65 | set test "test readnow and readnever at the same time" | |
66 | gdb_test_multiple "" $test { | |
67 | "'--readnow' and '--readnever' cannot be specified simultaneously" { | |
68 | pass $test | |
69 | set test "expect eof after failure" | |
70 | gdb_test_multiple "" $test { | |
71 | eof { | |
72 | pass $test | |
73 | } | |
74 | } | |
75 | } | |
76 | } | |
77 | } | |
78 | ||
79 | ||
80 | # Test symbol-file's -readnever option. | |
81 | ||
82 | # Restart GDB without the --readnever option. | |
83 | gdb_exit | |
84 | gdb_start | |
85 | gdb_test "symbol-file ${binfile}0.o -readnever" \ | |
3453e7e4 | 86 | "Reading symbols from ${binfile}0\.o\.\.\.\r\n\\\(No debugging symbols found in .*\\\)" \ |
97cbe998 SDJ |
87 | "use symbol-file -readnever" |
88 | ||
89 | gdb_test_no_output "maint info symtabs" \ | |
90 | "maint info symtabs no output for symbol-file -readnever" | |
91 | gdb_test_no_output "maint info psymtabs" \ | |
92 | "maint info psymtabs no output for symbol-file -readnever" |