]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.hp/gdb.aCC/optimize.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.aCC / optimize.exp
CommitLineData
6aba47ca 1# Copyright (C) 1998, 2007 Free Software Foundation, Inc.
7be570e7
JM
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# optimize.exp -- Expect script for testing apps compiled with -O
21
22# There is no DOC support for gdb yet, return 0 for now.
23return 0
24
25global timeout
26
27# use this to debug:
28#
29#log_user 1
30
31if $tracelevel then {
32 strace $tracelevel
33}
34
35if { [skip_hp_tests] } then { continue }
36
37set testfile optimize
38set srcfile ${testfile}.c
39set binfile ${objdir}/${subdir}/${testfile}
40
41if [get_compiler_info ${binfile}] {
42 return -1;
43}
44
45
46if { $gcc_compiled } then { continue }
47
48
49# Vanilla -O, which is the same as +O2
50#
51if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug optimize=+O2}] != "" } {
b60f0898
JB
52 untested optimize.exp
53 return -1
7be570e7
JM
54}
55
56
57gdb_exit
58gdb_start
59gdb_reinitialize_dir $srcdir/$subdir
60
61send_gdb "file $binfile\n"
62gdb_expect {
63 -re ".*no debugging symbols found.*$gdb_prompt $" {
64 fail "Didn't find debug symbols; CHFts23488"
65 }
66 -re ".*No header section (PXDB data).*$gdb_prompt $" {
67 fail "pointless warning"
68 }
69 -re ".*done.*$gdb_prompt $" {
70 pass "load debug symbols"
71 }
72 timeout { fail "timeout on file" }
73}
74
75# Two lines at the same place after opt.
76#
77gdb_test "b 28" ".*"
78gdb_test "b 26" ".*also set at.*" "same line"
79
80gdb_test "b 47" ".*"
81gdb_test "b 48" ".*also set at.*" "same line"
82
83gdb_test "tb main" ".*"
84
85set old_timeout $timeout
86set timeout [expr "$timeout + 200"]
87send_gdb "r\n"
88gdb_expect {
89 -re ".*No header section (PXDB data).*$gdb_prompt $" {
90 fail "pointless warning"
91 }
92 -re ".*main.*2\[12].*$gdb_prompt $" {
93 # All the lines before line 21 or 22 are
94 # evaporated by the compiler.
95 #
96 pass "hit main"
97 }
98 -re ".*$gdb_prompt $" {
99 fail "didn't hit main"
100 }
101 timeout { fail "timeout on run" }
102}
103set timeout $old_timeout
104
105gdb_test "c" ".*Breakpoint 1.*33.*"
106gdb_test "c" ".*51.*"
107gdb_test "cle" ".*Deleted breakpoints.*" "set 2, so del 2"
108
109gdb_test "b callee" ".*"
110gdb_test "c" ".*callee.*" "hit called rtn"
111
112gdb_exit
113
114# +O4, don't use -g
115#
116if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {optimize=+O4}] != "" } {
b60f0898
JB
117 untested optimize.exp
118 return -1
7be570e7
JM
119}
120
121gdb_start
122gdb_reinitialize_dir $srcdir/$subdir
123
124send_gdb "file $binfile\n"
125gdb_expect {
126 -re ".*no debugging symbols found.*$gdb_prompt $" {
127 pass "Didn't find debug symbols, as expected"
128 }
129 -re ".*No header section (PXDB data).*$gdb_prompt $" {
130 fail "pointless warning"
131 }
132 -re ".*done.*$gdb_prompt $" {
133 fail "Somehow found debug symbols--make this a pass?"
134 }
135 timeout { fail "timeout on file" }
136}
137
138gdb_test "b main" ".*"
139gdb_test "b callee" ".*"
140gdb_test "r" ".*Breakpoint 1.*main.*"
141gdb_test "si 3" ".*main.*" "steps"
142gdb_test "x/4i \$pc" ".*main.*main+4.*main+8.*"
143gdb_test "c" ".*callee.*" "hit bp"
144gdb_test "disas" ".*callee.*callee+4.*callee+12.*"
145gdb_test "si" ".*callee.*"
146gdb_test "fin" ".*Run till exit.*main.*" "finish"
147gdb_test "x/i \$pc" ".*main+.*" "back in main"
148gdb_exit
149
150#remote_exec build "rm -f ${binfile}"
151return 0