1# Copyright 1998, 1999, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17if $tracelevel then {
18	strace $tracelevel
19}
20
21set prototypes 1
22set testfile "structs2"
23set srcfile ${testfile}.c
24set binfile ${objdir}/${subdir}/${testfile}
25
26# Create and source the file that provides information about the compiler
27# used to compile the test case.
28if [get_compiler_info ${binfile}] {
29    return -1;
30}
31
32# build the first test case
33if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
34    # built the second test case since we can't use prototypes
35    warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
36    if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
37	untested structs2.exp
38	return -1
39    }
40    set prototypes 0
41}
42
43# Start with a fresh gdb.
44
45gdb_start
46gdb_reinitialize_dir $srcdir/$subdir
47gdb_load ${binfile}
48
49gdb_test_no_output "set width 0"
50
51if { ![runto_main] } then {
52    gdb_suppress_tests
53}
54
55# Ok, we're finally ready to actually do our tests.
56
57gdb_test "f" \
58    ".*bkpt = 0.*" \
59    "structs2 sanity check"
60
61gdb_test "break param_reg" \
62    "Breakpoint .* at .*" \
63    "structs2 breakpoint set"
64
65if [test_compiler_info gcc-3-*] {
66  setup_xfail hppa*-* gcc/15860
67}
68gdb_test "continue" \
69    ".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \
70    "structs2 continue1"
71
72if [test_compiler_info gcc-3-*] {
73  setup_xfail hppa*-* gcc/15860
74}
75gdb_test "continue" \
76    ".*pr_char=-126.*pr_uchar=120.*pr_short=-32536.*pr_ushort=32000.*bkpt = 1.*" \
77    "structs2 continue2"
78
79# End of tests.
80
81gdb_stop_suppressing_tests
82
83return 0
84