1# Copyright 2016-2020 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 23# See if we have target board readnow.exp or similar. 24if { [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 30save_vars { GDBFLAGS } { 31 append GDBFLAGS " --readnever" 32 if { [clean_restart ${binfile}] == -1 } { 33 return -1 34 } 35} 36 37if ![runto_main] then { 38 perror "couldn't run to breakpoint" 39 continue 40} 41 42gdb_test "break fun_three" \ 43 "Breakpoint $decimal at $hex" 44 45gdb_test "continue" \ 46 "Breakpoint $decimal, $hex in fun_three \\(\\)" 47 48gdb_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 54gdb_test_no_output "maint info symtabs" \ 55 "maint info symtabs no output for --readnever" 56gdb_test_no_output "maint info psymtabs" \ 57 "maint info psymtabs no output for --readnever" 58 59# Test invalid combination of flags. 60save_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. 83gdb_exit 84gdb_start 85gdb_test "symbol-file ${binfile}0.o -readnever" \ 86 "Reading symbols from ${binfile}0\.o\.\.\.\r\n\\\(No debugging symbols found in .*\\\)" \ 87 "use symbol-file -readnever" 88 89gdb_test_no_output "maint info symtabs" \ 90 "maint info symtabs no output for symbol-file -readnever" 91gdb_test_no_output "maint info psymtabs" \ 92 "maint info psymtabs no output for symbol-file -readnever" 93