| 1 | # Copyright 2016-2018 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 | |
| 16 | standard_testfile .c |
| 17 | |
| 18 | if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } { |
| 19 | untested "Couldn't compile ${srcfile}" |
| 20 | return -1 |
| 21 | } |
| 22 | |
| 23 | save_vars { GDBFLAGS } { |
| 24 | append GDBFLAGS " --readnever" |
| 25 | clean_restart ${binfile} |
| 26 | } |
| 27 | |
| 28 | if ![runto_main] then { |
| 29 | perror "couldn't run to breakpoint" |
| 30 | continue |
| 31 | } |
| 32 | |
| 33 | gdb_test "break fun_three" \ |
| 34 | "Breakpoint $decimal at $hex" |
| 35 | |
| 36 | gdb_test "continue" \ |
| 37 | "Breakpoint $decimal, $hex in fun_three \\(\\)" |
| 38 | |
| 39 | gdb_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 | |
| 45 | gdb_test_no_output "maint info symtabs" \ |
| 46 | "maint info symtabs no output for --readnever" |
| 47 | gdb_test_no_output "maint info psymtabs" \ |
| 48 | "maint info psymtabs no output for --readnever" |
| 49 | |
| 50 | # Test invalid combination of flags. |
| 51 | save_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. |
| 74 | gdb_exit |
| 75 | gdb_start |
| 76 | gdb_test "symbol-file ${binfile}0.o -readnever" \ |
| 77 | "Reading symbols from ${binfile}0\.o\.\.\.\\\(no debugging symbols found\\\)\.\.\.done\." \ |
| 78 | "use symbol-file -readnever" |
| 79 | |
| 80 | gdb_test_no_output "maint info symtabs" \ |
| 81 | "maint info symtabs no output for symbol-file -readnever" |
| 82 | gdb_test_no_output "maint info psymtabs" \ |
| 83 | "maint info psymtabs no output for symbol-file -readnever" |