* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / smoke.exp
CommitLineData
f5f100fe
DT
1# Copyright (C) 1997, 1998 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 2 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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# smoke.exp -- Expect script to test gdb before checkins
21
22# use this to debug:
23#
24#log_user 1
25
26if $tracelevel then {
27 strace $tracelevel
28}
29
30set testfile smoke
31set testfile1 smoke1
32set c_srcfile ${srcdir}/${subdir}/${testfile}.c
33set cpp_srcfile ${srcdir}/${subdir}/${testfile}.cc
34set binfile ${objdir}/${subdir}/${testfile}
35set binfile1 ${objdir}/${subdir}/${testfile1}
36
37#remote_exec build "rm -f ${binfile}"
38remote_exec build "rm -f core"
39
40# "C" section, using source copied from "step-test.c" from "gdb.base"
41#
42if { [gdb_compile "${c_srcfile}" "${binfile}" executable {debug}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44}
45
46gdb_exit
47gdb_start
48gdb_reinitialize_dir $srcdir/$subdir
49gdb_load ${binfile}
50
51# Some basic tests
52#
53gdb_test "tb main" ".*Breakpoint 1 at.*line 15.*" "temp breakpoint"
54gdb_test "b callee" ".*Breakpoint 2 at.*line 6.*" "breakpoint"
55gdb_test "l 10" ".*10.*int main.*11.*int w,x,y,z;.*12.*int a.*" "list"
56gdb_test "c" ".*The program is not being run.*" "catch error"
57gdb_test "r" ".*Starting program.*main.*15.*" "hit bp"
58gdb_test "hel r" ".*Start debugged program.*without arguments.*" "help"
59gdb_test "n" ".*x = 1;.*" "next"
60gdb_test "s" ".*y = 2;.*" "step"
bdb7b085 61gdb_test "p/t y" ".* = 1.*" "print y in binary"
f5f100fe
DT
62gdb_test "p 1+2*3+4" ".* = 11.*" "calculate"
63gdb_test "p/t 1+2*3+4" ".* = 1011.*" "binary"
64
65# Note: accept either "Watchpoint" or "Hardware watchpoint";
66# 10.20 can't do the hardware watch. The hardware kind
67# triggers one line earlier than the regular kind.
68#
69gdb_test "wat y" ".*atchpoint.*y.*" "set watch"
70gdb_test "c" ".*atchpoint.*Old.*= .*New.*= 2.*1\[78\].*" "continue, hit watch"
71
72gdb_test "set glob=999" ".*.*" "set"
a502297e 73gdb_test "p glob" ".*= 999.*.*" "print glob"
f5f100fe
DT
74gdb_test "p/x glob" ".*= 0x3e7.*" "hex"
75gdb_test "c" ".*atchpoint.*Old.*= 2.*New.*= 6.*2\[12\].*" "continue, 2nd hit watch"
76gdb_test "d 5" "No breakpoint number 5." "del non existing watch"
77gdb_test "c" ".*Breakpoint.*callee.*6.*" "hit bp"
78gdb_test "bt" ".*callee.*6.*main.*25.*" "bt"
79gdb_test "fin" ".*Run till exit.*callee.*Value returned.*0.*" "finish"
80gdb_test "c" ".*Breakpoint.*callee.*6.*" "hit bp again"
81gdb_test "cle" ".*Deleted breakpoint.*" "clear"
82gdb_test "wat glob" ".*atchpoint.*glob.*" "set 2nd watch"
83gdb_test "i wat" ".*" ""
84gdb_test "whe" ".*" ""
85
86# ??rehrauer: We're now disabling watchpoints while an interactive
87# call is "in flight". When/if we can teach gdb how to unwind through
88# the call dummy frame, we can then allow watches during calls, and
89# also then restore this testpoint to the original, commented-out form.
90#
91gdb_test "call callee()" ".*\[0-9\]* = 0.*" "call, didn't hit watch"
92#gdb_test "call callee()" ".*atchpoint.*Old.*= 1000.*New.*= 1001.*\[67\].*being debug.*is done.*" "call, hit watch"
93
94gdb_test "d 4" ".*" "del watch 2"
95gdb_test "d 3" ".*" "del watch 1"
96gdb_test "info break" "No breakpoints or watchpoints."
97# since we have deleted all the watchpoints this test is useless
98#gdb_test "c" ".*Continuing.*" "end call"
99gdb_test "c" ".*Program exited normally.*" "pgm exit"
100
101# Check for production of a core file
102#
103#set exec_output [execute_anywhere "ls core"]
104set exec_output [remote_exec build "ls core"]
105
106if [ regexp "core not found" $exec_output] {
107 pass "No core dumped on quit"
108} else {
109 if [ regexp "No such file or directory" $exec_output] {
110 pass "ls: core: No core dumped on quit"
111 } else {
112 remote_exec build "rm -f core"
113 fail "Core dumped on quit"
114 }
115}
116
117
118#========================================
119#
120# "C++" section, using source copied from "misc.cc" from "gdb.c++"
121#
122
123#
124#remote_exec build "rm -f ${binfile}"
125#remote_exec build "CC -g -o ${binfile} ${cpp_srcfile}"
126if {[gdb_compile "${cpp_srcfile}" "${binfile1}" executable {c++ debug}] != ""} {
127 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
128}
129
130gdb_exit
131gdb_start
132gdb_reinitialize_dir $srcdir/$subdir
133gdb_load ${binfile1}
134
135# Tests, some copied from misc.exp.
136#
137
138 # See what language gdb thinks main() is, prior to reading full symbols.
139 # I think this fails for COFF targets.
140 setup_xfail "a29k-*-udi"
141 send_gdb "show language\n"
142 gdb_expect {
143 -re ".* source language is \"auto; currently c\\+\\+\".*$gdb_prompt $" {
144 pass "deduced language is C++, before full symbols"
145 }
146 -re ".*$gdb_prompt $" { fail "source language not correct for C++ (psymtabs only)"}
147 return
148
149 timeout { fail "can't show language (timeout)"}
150 return
151 }
152
153gdb_test "b main" ".*Breakpoint 1 at.*" ""
154gdb_test "r" ".*Starting program.*Breakpoint 1.*" "run to main"
155gdb_test "ptype Foo" ".*type = class Foo.*static int st;.*int operator.*" "ptype"
156gdb_test "step" ".*inheritance1.*" "step"
157gdb_test "ptype g_anon_union" ".*anon_union.*union.*int a;.*" "anon"
a502297e 158gdb_test "p g_E" ".*class D.*class B.*class A.*class C.*class A.*x = 0.*" "print inherited class "
f5f100fe
DT
159gdb_test "p g_E.x = 99" ".*warn.*x ambiguous; using E::x. Use a cast to disambig.*99.*" "set via print"
160gdb_test "c" ".*Program exited.*" "run to end"
161
162gdb_exit
163
164# Check for production of a core file
165#
166#set exec_output [execute_anywhere "ls core"]
167set exec_output [remote_exec build "ls core"]
168if [ regexp "core not found" $exec_output] {
169 pass "No core dumped on quit"
170} else {
171 if [ regexp "No such file or directory" $exec_output] {
172 pass "ls: core: No core dumped on quit"
173 } else {
174 remote_exec build "rm -f core"
175 fail "Core dumped on quit"
176 }
177}
178
179# execute_anywhere "rm -f ${binfile1}"
180#
181return 0
This page took 0.037027 seconds and 4 git commands to generate.