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.base/] [cond-expr.exp] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1998, 1999, 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
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
 
18
# This file is part of the gdb testsuite
19
 
20
#
21
# test of evaluation of conditional expressions, with constants and
22
# variables. Using the print and the whatis command
23
# written with the only purpose in mind to cover the holes in the
24
# eval.c file
25
#
26
# source file "int-type.c"
27
#
28
 
29
 
30
if $tracelevel then {
31
        strace $tracelevel
32
}
33
 
34
# Check to see if we have an executable to test.  If not, then either we
35
# haven't tried to compile one, or the compilation failed for some reason.
36
# In either case, just notify the user and skip the tests in this file.
37
 
38
set testfile "int-type"
39
set srcfile ${testfile}.c
40
set binfile ${objdir}/${subdir}/${testfile}
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
42
     untested cond-expr.exp
43
     return -1
44
    }
45
 
46
 
47
gdb_exit
48
gdb_start
49
gdb_reinitialize_dir $srcdir/$subdir
50
gdb_load ${binfile}
51
 
52
 
53
if ![runto_main] then {
54
    perror "couldn't run to breakpoint"
55
    continue
56
}
57
 
58
send_gdb "print (2 ? 3 : 4)\n"
59
gdb_expect {
60
    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
61
        pass "print value of cond expr (const true)"
62
      }
63
    -re ".*$gdb_prompt $" { fail "print value of cond expr (const true)" }
64
    timeout           { fail "(timeout) print value of cond expr (const true)" }
65
  }
66
 
67
send_gdb "print (0 ? 3 : 4)\n"
68
gdb_expect {
69
    -re ".\[0-9\]* = 4.*$gdb_prompt $" {
70
        pass "print value of cond expr (const false)"
71
      }
72
    -re ".*$gdb_prompt $" { fail "print value of cond expr (const false)" }
73
    timeout           { fail "(timeout) print value of cond expr (const false)" }
74
  }
75
 
76
gdb_test "set variable x=14" "" "set variable x=14"
77
gdb_test "set variable y=2" "" "set variable y=2"
78
gdb_test "set variable z=3" "" "set variable z=3"
79
 
80
send_gdb "print (x ? y : z)\n"
81
gdb_expect {
82
    -re ".\[0-9\]* = 2.*$gdb_prompt $" {
83
        pass "print value of cond expr (var true)"
84
      }
85
    -re ".*$gdb_prompt $" { fail "print value of cond expr (var true)" }
86
    timeout           { fail "(timeout) print value of cond expr (var true)" }
87
  }
88
 
89
gdb_test "set variable x=0" "" "set variable x=0"
90
 
91
send_gdb "print (x ? y : z)\n"
92
gdb_expect {
93
    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
94
        pass "print value of cond expr (var false)"
95
      }
96
    -re ".*$gdb_prompt $" { fail "print value of cond expr (var false)" }
97
    timeout           { fail "(timeout) print value of cond expr (var false)" }
98
  }
99
 
100
 
101
send_gdb "whatis (0 ? 3 : 4)\n"
102
gdb_expect {
103
    -re "type = int.*$gdb_prompt $" {
104
        pass "print whatis of cond expr"
105
      }
106
    -re ".*$gdb_prompt $" { fail "print whatis of cond expr" }
107
    timeout           { fail "(timeout) print whatis of cond expr" }
108
  }
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
 
118
 
119
 

powered by: WebSVN 2.1.0

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