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