OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.hp/] [gdb.aCC/] [optimize.exp] - Blame information for rev 387

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.