Home | History | Annotate | Line # | Download | only in gdb.tui
      1 # Copyright 2019-2024 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 # Test that "file" shows "main".
     17 
     18 require allow_tui_tests
     19 
     20 tuiterm_env
     21 
     22 standard_testfile tui-layout.c
     23 
     24 if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
     25     return -1
     26 }
     27 
     28 # Note: don't pass the executable here
     29 Term::clean_restart 24 80
     30 
     31 set line "  return 0;"
     32 set nr [gdb_get_line_number $line]
     33 
     34 # Later on we'd like to avoid having to answer a question.
     35 gdb_test_no_output "set interactive-mode off"
     36 
     37 # Show the left margin using tui-left-margin-verbose.
     38 gdb_test_no_output "maint set tui-left-margin-verbose on"
     39 
     40 if {![Term::enter_tui]} {
     41     unsupported "TUI not supported"
     42     return
     43 }
     44 
     45 send_gdb "file [standard_output_file $testfile]\n"
     46 gdb_assert { [Term::wait_for "Reading symbols from"] } "file command"
     47 Term::check_contents "show main after file" \
     48     [string_to_regexp "|___[format %06d $nr]_$line"]
     49 
     50 # Ensure that "file" clears the source window.
     51 Term::command "file"
     52 Term::check_contents "file clears window" "No Source Available"
     53