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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.hp/] [gdb.aCC/] [optimize.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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