| # Copyright 2016-2026 Free Software Foundation, Inc. | |
| # This program is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation; either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| # See if we have target board readnow.exp or similar. We're using | |
| # --readnever, which is not allowed in combination with --readnow. | |
| require !readnow | |
| standard_testfile .c | |
| if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } { | |
| untested "couldn't compile ${srcfile}" | |
| return -1 | |
| } | |
| save_vars { GDBFLAGS } { | |
| append GDBFLAGS " --readnever" | |
| if { [clean_restart $testfile] == -1 } { | |
| return -1 | |
| } | |
| } | |
| if {![runto_main]} { | |
| return | |
| } | |
| gdb_test "break fun_three" \ | |
| "Breakpoint $decimal at $hex" | |
| gdb_test "continue" \ | |
| "Breakpoint $decimal, $hex in fun_three \\(\\)" | |
| gdb_test "backtrace" \ | |
| [multi_line "#0 $hex in fun_three \\(\\)" \ | |
| "#1 $hex in fun_two \\(\\)" \ | |
| "#2 $hex in fun_one \\(\\)" \ | |
| "#3 $hex in main \\(\\)" ] | |
| gdb_test_no_output "maint info symtabs" \ | |
| "maint info symtabs no output for --readnever" | |
| gdb_test_no_output "maint info psymtabs" \ | |
| "maint info psymtabs no output for --readnever" | |
| # Test invalid combination of flags. | |
| save_vars { GDBFLAGS } { | |
| append GDBFLAGS " --readnever --readnow" | |
| gdb_exit | |
| gdb_spawn | |
| set test "test readnow and readnever at the same time" | |
| gdb_test_multiple "" $test { | |
| "'--readnow' and '--readnever' cannot be specified simultaneously" { | |
| pass $test | |
| set test "expect eof after failure" | |
| gdb_test_multiple "" $test { | |
| eof { | |
| pass $test | |
| } | |
| } | |
| } | |
| } | |
| } | |
| # Test symbol-file's -readnever option. | |
| # Restart GDB without the --readnever option. | |
| gdb_exit | |
| gdb_start | |
| gdb_test "symbol-file ${binfile}0.o -readnever" \ | |
| "Reading symbols from ${binfile}0\.o\.\.\.\r\n\\\(No debugging symbols found in .*\\\)" \ | |
| "use symbol-file -readnever" | |
| gdb_test_no_output "maint info symtabs" \ | |
| "maint info symtabs no output for symbol-file -readnever" | |
| gdb_test_no_output "maint info psymtabs" \ | |
| "maint info psymtabs no output for symbol-file -readnever" |