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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.pascal/] [integers.exp] - Blame information for rev 24

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

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 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
if $tracelevel then {
17
    strace $tracelevel
18
}
19
 
20
load_lib "pascal.exp"
21
 
22
set testfile "integers"
23
set srcfile ${testfile}.pas
24
set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
25
 
26
if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
27
  return -1
28
}
29
 
30
gdb_exit
31
gdb_start
32
gdb_reinitialize_dir $srcdir/$subdir
33
gdb_load ${binfile}
34
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
35
set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
36
 
37
if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
38
    pass "setting breakpoint 1"
39
}
40
if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
41
    pass "setting breakpoint 2"
42
}
43
 
44
# Verify that "start" lands inside the right procedure.
45
if { [gdb_start_cmd] < 0 } {
46
    untested start
47
    return -1
48
}
49
 
50
gdb_test "" ".* at .*${srcfile}.*" "start"
51
 
52
gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
53
 
54
gdb_test "print i" ".* = 0" "Print i before assigned to 1"
55
 
56
gdb_test "next" "i := 1;" "Next to 'i := 1' line"
57
gdb_test "next" "j := 2;" "Next to 'j := 2' line"
58
# At that point,
59
# i should be equal to 1
60
gdb_test "print i" " = 1"
61
# but j should still be equal to zero
62
if { $pascal_compiler_is_gpc } {
63
  setup_xfail *-*-*
64
}
65
gdb_test "print j" " = 0" "Test j value before assignment"
66
 
67
gdb_test "next" "k := 3;" "Next to 'k := 3' line"
68
gdb_test "next" "l := k;" "Next to 'l := k' line"
69
 
70
#j should be equal to 2
71
gdb_test "print j" " = 2"
72
# k should be equal to 3
73
gdb_test "print k" " = 3"
74
# But l shoud still be zero
75
if { $pascal_compiler_is_gpc } {
76
  setup_xfail *-*-*
77
}
78
gdb_test "print l" " = 0"
79
 
80
# Test addition
81
gdb_test "print i + j" " = 3"
82
gdb_test "print i + k" " = 4"
83
gdb_test "print j + k" " = 5"
84
gdb_test "print i + j + k" " = 6"
85
 
86
# Test substraction
87
gdb_test "print j - i" " = 1"
88
gdb_test "print i - j" "= -1"
89
gdb_test "print k -i -j" " = 0"
90
gdb_test "print k -(i + j)" " = 0"
91
 
92
# Test unany minus
93
gdb_test "print -i" " = -1"
94
gdb_test "print (-i)" " = -1"
95
gdb_test "print -(i)" " = -1"
96
gdb_test "print -(i+j)" " = -3"
97
 
98
# Test boolean operators =, <>, <, <=, > and >=
99
gdb_test "print i + 1 = j" " = true"
100
gdb_test "print i + 1 <> j" " = false"
101
gdb_test "print i + 1 < j" " = false"
102
gdb_test "print i + 1 <= j" " = true"
103
gdb_test "print i + 1 > j" " = false"
104
gdb_test "print i + 1 >= j" " = true"
105
 
106
# Test multiplication
107
gdb_test "print 2 * i" " = 2"
108
gdb_test "print j * k" " = 6"
109
gdb_test "print 3000*i" " = 3000"
110
 
111
#Test div and mod operators
112
gdb_test "print 35 div 2" " = 17"
113
gdb_test "print 35 mod 2" " = 1"
114
 
115
# Test several operators together
116
gdb_test "print i+10*j+100*k" " = 321"
117
gdb_test " print (i + 5) * (j + 7)" " = 54"
118
 
119
# 'set i' does not work, as there are set sub-commands starting with 'i'
120
# Thus we need to use 'set var i'
121
gdb_test "set var i := 2" " := 2"
122
gdb_test "print i" " = 2" "Testing new i value"
123
 
124
gdb_test "cont" \
125
         "Breakpoint .*:${bp_location2}.*" \
126
         "Going to second breakpoint"
127
gdb_test "print i" \
128
         ".* = 5.*" \
129
         "Value of i after assignment"

powered by: WebSVN 2.1.0

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