Use CXXCOMPILE in gold/testsuite/Makefile for c++ testcases
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / list-missing-source.exp
CommitLineData
b811d2c2 1# Copyright 2019-2020 Free Software Foundation, Inc.
67f3ed6a
AB
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# This test checks how GDB handles missing source files around the
17# 'list' and 'info source' commands.
18
19standard_testfile
20
21# Create a source file in the output directory.
22set srcfile [standard_output_file main.c]
23set fd [open "$srcfile" w]
24puts $fd {
25int
26main ()
27{
28 return 0;
29}
30}
31close $fd
32
33# Compile the source file.
34set options "debug"
35if { [gdb_compile "${srcfile}" "${binfile}" \
36 executable $options] != "" } {
37 untested "failed to compile"
38 return -1
39}
40
41# Now delete the source file.
42file delete $srcfile
43
44# Now start GDB, run to main and try to list the source.
45clean_restart ${binfile}
46
47if ![runto_main] then {
48 fail "can't run to main"
49 return 0
50}
51
52gdb_test "list" "1\[ \t\]+in\[ \t\]+$srcfile"
53
54gdb_test "info source" \
55 [multi_line \
56 "info source" \
3a56ed86
TV
57 "Current source file is $srcfile\(" \
58 "Compilation directory is \[^\n\r\]+)?" \
67f3ed6a
AB
59 "Source language is c." \
60 "Producer is \[^\n\r\]+" \
61 "Compiled with DWARF $decimal debugging format." \
62 "Does not include preprocessor macro info." ]
63
This page took 0.153077 seconds and 4 git commands to generate.