xref: /netbsd-src/external/gpl3/gdb/dist/gdb/testsuite/gdb.base/readnever.exp (revision f3cfa6f6ce31685c6c4a758bc430e69eb99f50a4)
1# Copyright 2016-2019 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
16standard_testfile .c
17
18if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
19    untested "couldn't compile ${srcfile}"
20    return -1
21}
22
23save_vars { GDBFLAGS } {
24    append GDBFLAGS " --readnever"
25    clean_restart ${binfile}
26}
27
28if ![runto_main] then {
29    perror "couldn't run to breakpoint"
30    continue
31}
32
33gdb_test "break fun_three" \
34         "Breakpoint $decimal at $hex"
35
36gdb_test "continue" \
37         "Breakpoint $decimal, $hex in fun_three \\(\\)"
38
39gdb_test "backtrace" \
40         [multi_line "#0  $hex in fun_three \\(\\)" \
41                     "#1  $hex in fun_two \\(\\)" \
42                     "#2  $hex in fun_one \\(\\)" \
43                     "#3  $hex in main \\(\\)" ]
44
45gdb_test_no_output "maint info symtabs" \
46    "maint info symtabs no output for --readnever"
47gdb_test_no_output "maint info psymtabs" \
48    "maint info psymtabs no output for --readnever"
49
50# Test invalid combination of flags.
51save_vars { GDBFLAGS } {
52    append GDBFLAGS " --readnever --readnow"
53    gdb_exit
54    gdb_spawn
55
56    set test "test readnow and readnever at the same time"
57    gdb_test_multiple "" $test {
58	"'--readnow' and '--readnever' cannot be specified simultaneously" {
59	    pass $test
60	    set test "expect eof after failure"
61	    gdb_test_multiple "" $test {
62		eof {
63		    pass $test
64		}
65	    }
66	}
67    }
68}
69
70
71# Test symbol-file's -readnever option.
72
73# Restart GDB without the --readnever option.
74gdb_exit
75gdb_start
76gdb_test "symbol-file ${binfile}0.o -readnever" \
77    "Reading symbols from ${binfile}0\.o\.\.\.\r\n\\\(No debugging symbols found in .*\\\)" \
78    "use symbol-file -readnever"
79
80gdb_test_no_output "maint info symtabs" \
81    "maint info symtabs no output for symbol-file -readnever"
82gdb_test_no_output "maint info psymtabs" \
83    "maint info psymtabs no output for symbol-file -readnever"
84