1 # Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
26 # Check to see if we have an executable to test. If not, then either we
27 # haven't tried to compile one, or the compilation failed for some reason.
28 # In either case, just notify the user and skip the tests in this file.
31 set srcfile ${testfile}.cc
32 set binfile ${objdir}/${subdir}/${testfile}
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
34 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
38 # Deduce language of main()
41 proc deduce_language_of_main {} {
44 # See what language gdb thinks main() is, prior to reading full symbols.
45 # I think this fails for COFF targets.
46 setup_xfail "a29k-*-udi"
47 send_gdb "show language\n"
49 -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
50 pass "deduced language is C++, before full symbols"
52 -re ".*$gdb_prompt $" {
53 fail "source language not correct for C++ (psymtabs only)"
57 fail "can't show language (timeout)"
64 # See if our idea of the language has changed.
66 send_gdb "show language\n"
68 -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
69 pass "deduced language is C++, after full symbols"
71 -re ".*$gdb_prompt $" {
72 fail "source language not correct for C++ (full symbols)"
76 fail "can't show language (timeout)"
94 # Start with a fresh gdb.
98 gdb_reinitialize_dir $srcdir/$subdir
101 deduce_language_of_main
102 # Check for fixes for PRs 8916 and 8630
103 gdb_test "print s.a" ".* = 0" "print s.a for foo struct (known gcc 2.7.2 and earlier bug)"