daily update
[external/binutils.git] / gdb / testsuite / gdb.base / structs2.exp
1 # Copyright 1998, 1999, 2007, 2008, 2009, 2010 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 if $tracelevel then {
17         strace $tracelevel
18 }
19
20 set prms_id 0
21 set bug_id 0
22
23 set prototypes 1
24 set testfile "structs2"
25 set srcfile ${testfile}.c
26 set binfile ${objdir}/${subdir}/${testfile}
27
28 # Create and source the file that provides information about the compiler
29 # used to compile the test case.
30 if [get_compiler_info ${binfile}] {
31     return -1;
32 }
33
34 # build the first test case
35 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
36     # built the second test case since we can't use prototypes
37     warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
38     if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
39         untested structs2.exp
40         return -1
41     }
42     set prototypes 0
43 }
44
45 # Start with a fresh gdb.
46
47 gdb_start
48 gdb_reinitialize_dir $srcdir/$subdir
49 gdb_load ${binfile}
50
51 gdb_test "set width 0" ""
52
53 if { ![runto_main] } then {
54     gdb_suppress_tests
55 }
56
57 # Ok, we're finally ready to actually do our tests.
58
59 set prms_id 13536
60 set bug_id 0
61
62 gdb_test "f" \
63     ".*bkpt = 0.*" \
64     "structs2 sanity check"
65
66 gdb_test "break param_reg" \
67     "Breakpoint .* at .*" \
68     "structs2 breakpoint set"
69
70 if [test_compiler_info gcc-3-*] {
71   setup_xfail hppa*-* gcc/15860
72 }
73 gdb_test "continue" \
74     ".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \
75     "structs2 continue1"
76
77 if [test_compiler_info gcc-3-*] {
78   setup_xfail hppa*-* gcc/15860
79 }
80 gdb_test "continue" \
81     ".*pr_char=-126.*pr_uchar=120.*pr_short=-32536.*pr_ushort=32000.*bkpt = 1.*" \
82     "structs2 continue2"
83
84 # End of tests.
85
86 gdb_stop_suppressing_tests
87
88 return 0