1264790Sbapt#   Copyright 1997, 1999, 2007, 2008, 2009, 2010, 2011
2264790Sbapt#   Free Software Foundation, Inc.
3264790Sbapt
4264790Sbapt# This program is free software; you can redistribute it and/or modify
5264790Sbapt# it under the terms of the GNU General Public License as published by
6264790Sbapt# the Free Software Foundation; either version 3 of the License, or
7264790Sbapt# (at your option) any later version.
8264790Sbapt#
9264790Sbapt# This program is distributed in the hope that it will be useful,
10264790Sbapt# but WITHOUT ANY WARRANTY; without even the implied warranty of
11264790Sbapt# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12264790Sbapt# GNU General Public License for more details.
13264790Sbapt#
14264790Sbapt# You should have received a copy of the GNU General Public License
15264790Sbapt# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16264790Sbapt
17264790Sbaptif $tracelevel then {
18264790Sbapt	strace $tracelevel
19264790Sbapt}
20264790Sbapt
21264790Sbapt
22264790Sbaptset testfile twice-tmp
23264790Sbaptset srcfile ${testfile}.c
24264790Sbaptset binfile ${objdir}/${subdir}/${testfile}
25264790Sbaptset options debug
26264790Sbaptlappend options "additional_flags=-I."
27264790Sbapt
28264790Sbaptset fileid [open ${objdir}/${subdir}/${srcfile} w];
29264790Sbaptputs $fileid "#include \"twice.c\"";
30264790Sbaptclose $fileid;
31
32remote_download host ${srcdir}/${subdir}/twice.c twice.c
33
34if  { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } {
35     untested twice.exp
36     return -1
37}
38
39# Start with a fresh gdb.
40
41gdb_exit
42gdb_start
43gdb_reinitialize_dir $srcdir/$subdir
44gdb_load $binfile
45
46if [runto_main] then {
47    # Test that GDB can still detect whether we have line numbers
48    # even if we're executing code in an include file.
49
50    # The bug was fixed by
51    #Tue Jun 29 11:02:58 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
52    #
53    #	* infrun.c (wait_for_inferior): Use find_pc_line not
54    #	find_pc_symtab to check whether there is line number
55    #	information.
56
57    gdb_test "step" "nothing \\(\\) at.*"
58}
59remote_exec build "rm -f twice.c"
60return 0
61