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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [varargs.exp] - Blame information for rev 862

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1997, 1998, 1999, 2000, 2007, 2008, 2009, 2010
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .  */
16
 
17
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
 
19
 
20
# this file tests command line calls with functions having variable
21
# args list
22
# corresponding source file: varargs.c
23
 
24
#print find_max1(5,1,2,3,4,5)
25
#print find_max1(1,3)
26
#call find_max1(10,1,2,3,4,5,6,7,8,29,0)
27
#print find_max2(3,1,2,3)
28
#print find_max_double(5,1.0,17.0,2.0,3.0,4.0)
29
#quit
30
 
31
 
32
if $tracelevel then {
33
        strace $tracelevel
34
}
35
 
36
set prms_id 0
37
set bug_id 0
38
 
39
set prototypes 0
40
set testfile "varargs"
41
set srcfile ${testfile}.c
42
set binfile ${objdir}/${subdir}/${testfile}
43
 
44
if [get_compiler_info ${binfile}] {
45
    return -1
46
}
47
 
48
set additional_flags {debug}
49
 
50
if {$hp_cc_compiler} {
51
    lappend additional_flags "additional_flags=-Ae"
52
}
53
 
54
# build the first test case
55
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
56
           executable ${additional_flags}] != "" } {
57
     untested varargs.exp
58
     return -1
59
}
60
 
61
# Start with a fresh gdb.
62
 
63
gdb_exit
64
gdb_start
65
gdb_reinitialize_dir $srcdir/$subdir
66
gdb_load ${binfile}
67
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
68
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
69
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
70
 
71
if [gdb_skip_stdio_test "varargs.exp"] {
72
    # Nothing in this module is testable without printf.
73
    return;
74
}
75
 
76
if ![runto_main] then {
77
    perror "couldn't run to breakpoint"
78
    continue
79
}
80
 
81
if { $hp_aCC_compiler } {
82
    # When compiled w/ aCC we need to disable overload resolution
83
    # for command line calls.
84
    # We need it for vararg calls since the aCC compiler gives us no
85
    # information about the undeclared arguments, or even that there
86
    # _are_ undeclared arguments. As far as gdb is concerned it only
87
    # knows about the declared arguments. So we need to force the call
88
    # even though the overload resolution mechanism says that the types
89
    # don't match.
90
    # - guo
91
    gdb_test "set overload-resolution 0" ""
92
}
93
 
94
send_gdb "print find_max1(5,1,2,3,4,5)\n"
95
gdb_expect {
96
    -re ".*find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5.*$gdb_prompt $" {
97
        pass "print find_max1(5,1,2,3,4,5)"
98
      }
99
    -re ".*$gdb_prompt $" { fail "print find_max1(5,1,2,3,4,5)" }
100
    timeout           { fail "(timeout) print find_max1(5,1,2,3,4,5)" }
101
  }
102
 
103
 
104
 
105
 
106
send_gdb "print find_max1(1,3)\n"
107
gdb_expect {
108
    -re ".*find_max\\(1, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
109
        pass "print find_max1(1,3)"
110
      }
111
    -re ".*$gdb_prompt $" { fail "print find_max1(1,3)" }
112
    timeout           { fail "(timeout) print find_max1(1,3)" }
113
  }
114
 
115
 
116
send_gdb "print find_max1(10,1,2,3,4,5,6,7,8,29,0)\n"
117
gdb_expect {
118
    -re ".*find_max\\(10, 1, 2, 3, 4, 5, 6, 7, 8, 29, 0\\) returns 29\[ \r\n\]+.\[0-9\]+ = 29.*$gdb_prompt $" {
119
        pass "print find_max1(10,1,2,3,4,5,6,7,8,29,0)"
120
      }
121
    -re ".*$gdb_prompt $" { fail "print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
122
    timeout           { fail "(timeout) print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
123
  }
124
 
125
 
126
 
127
send_gdb "print find_max2(3,1,2,3)\n"
128
gdb_expect {
129
    -re ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
130
        pass "print find_max2(3,1,2,3)"
131
      }
132
    -re ".*$gdb_prompt $" { fail "print find_max2(3,1,2,3)" }
133
    timeout           { fail "(timeout) print find_max2(3,1,2,3)" }
134
  }
135
 
136
 
137
if {![target_info exists gdb,skip_float_tests]} {
138
  send_gdb "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)\n"
139
  gdb_expect {
140
    -re ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17.*$gdb_prompt $" {
141
      pass "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
142
    }
143
    -re ".*$gdb_prompt $" { fail "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
144
    timeout           { fail "(timeout) print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
145
  }
146
}
147
 

powered by: WebSVN 2.1.0

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