]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/lotsa-lines.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / lotsa-lines.exp
1 # Copyright 2023-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 a very long file is ok.
17
18 load_lib gdb-python.exp
19 require allow_python_tests
20
21 standard_testfile .c
22
23 # Create a source file with many lines.
24 set c_file [standard_output_file $srcfile]
25
26 set chan [open $c_file w]
27 puts $chan "int callee (int x) { return x; }"
28 for {set i 2} {$i < 65538} {incr i} {
29 puts $chan "int call$i () { return callee ($i); }"
30 }
31 puts $chan "int main() { return call65537(); }"
32 close $chan
33
34 if {[prepare_for_testing "failed to prepare" ${testfile} \
35 [list $c_file] {debug}]} {
36 return
37 }
38
39 if {![runto callee]} {
40 return
41 }
42
43 gdb_test "print x" " = 65537"
44
45 # This doesn't actually demonstrate the bug, because it takes a code
46 # path not checking symbol::line.
47 gdb_test "frame 1" "call65537.*lotsa-lines.c:65537.*"
48
49 # This is the simplest way to see the problem.
50 gdb_test "python print(gdb.selected_frame().function().line)" "65537" \
51 "print function line number"