Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: gdb/testsuite/gdb.go/integers.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.go/hello.go ('k') | gdb/testsuite/gdb.go/integers.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008-2012 Free Software Foundation, Inc. 1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2012 Free Software Foundation, Inc.
2 # 4 #
3 # This program is free software; you can redistribute it and/or modify 5 # 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 6 # 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 7 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version. 8 # (at your option) any later version.
7 # 9 #
8 # This program is distributed in the hope that it will be useful, 10 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 13 # GNU General Public License for more details.
12 # 14 #
13 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 17
16 if $tracelevel then { 18 # Test integer expressions.
17 strace $tracelevel 19
20 load_lib "go.exp"
21
22 if { [skip_go_tests] } { continue }
23
24 standard_testfile .go
25
26 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
27 return -1
18 } 28 }
19 29
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"] 30 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
35 set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] 31 set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
36 32
33 if { [go_runto_main] < 0 } {
34 untested $testfile
35 return -1
36 }
37
37 if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { 38 if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
38 pass "setting breakpoint 1" 39 pass "setting breakpoint 1"
39 } 40 }
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 41
52 gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" 42 gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
53 43
54 gdb_test "print i" ".* = 0" "Print i before assigned to 1" 44 gdb_test "print i" ".* = 0" "Print i before assigned to 1"
55 45
56 gdb_test "next" "i := 1;" "Next to 'i := 1' line" 46 gdb_test "next" "i = 1" "Next to 'i = 1' line"
57 gdb_test "next" "j := 2;" "Next to 'j := 2' line" 47 gdb_test "next" "j = 2" "Next to 'j = 2' line"
58 # At that point, 48 # At that point,
59 # i should be equal to 1 49 # i should be equal to 1
60 gdb_test "print i" " = 1" 50 gdb_test "print i" " = 1"
61 # but j should still be equal to zero 51 # 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" 52 gdb_test "print j" " = 0" "Test j value before assignment"
66 53
67 gdb_test "next" "k := 3;" "Next to 'k := 3' line" 54 gdb_test "next" "k = 3" "Next to 'k = 3' line"
68 gdb_test "next" "l := k;" "Next to 'l := k' line" 55 gdb_test "next" "l = k" "Next to 'l = k' line"
69 56
70 #j should be equal to 2 57 #j should be equal to 2
71 gdb_test "print j" " = 2" 58 gdb_test "print j" " = 2"
72 # k should be equal to 3 59 # k should be equal to 3
73 gdb_test "print k" " = 3" 60 gdb_test "print k" " = 3"
74 # But l shoud still be zero 61 # But l should still be zero
75 if { $pascal_compiler_is_gpc } {
76 setup_xfail *-*-*
77 }
78 gdb_test "print l" " = 0" 62 gdb_test "print l" " = 0"
79 63
80 # Test addition 64 # Test addition
81 gdb_test "print i + j" " = 3" 65 gdb_test "print i + j" " = 3"
82 gdb_test "print i + k" " = 4" 66 gdb_test "print i + k" " = 4"
83 gdb_test "print j + k" " = 5" 67 gdb_test "print j + k" " = 5"
84 gdb_test "print i + j + k" " = 6" 68 gdb_test "print i + j + k" " = 6"
85 69
86 # Test substraction 70 # Test substraction
87 gdb_test "print j - i" " = 1" 71 gdb_test "print j - i" " = 1"
88 gdb_test "print i - j" "= -1" 72 gdb_test "print i - j" "= -1"
89 gdb_test "print k -i -j" " = 0" 73 gdb_test "print k -i -j" " = 0"
90 gdb_test "print k -(i + j)" " = 0" 74 gdb_test "print k -(i + j)" " = 0"
91 75
92 # Test unany minus 76 # Test unany minus
93 gdb_test "print -i" " = -1" 77 gdb_test "print -i" " = -1"
94 gdb_test "print (-i)" " = -1" 78 gdb_test "print (-i)" " = -1"
95 gdb_test "print -(i)" " = -1" 79 gdb_test "print -(i)" " = -1"
96 gdb_test "print -(i+j)" " = -3" 80 gdb_test "print -(i+j)" " = -3"
97 81
98 # Test boolean operators =, <>, <, <=, > and >= 82 # Test boolean operators =, <>, <, <=, > and >=
99 gdb_test "print i + 1 = j" " = true" 83 gdb_test "print i + 1 == j" " = true"
100 gdb_test "print i + 1 <> j" " = false" 84 gdb_test "print i + 1 != j" " = false"
101 gdb_test "print i + 1 < j" " = false" 85 gdb_test "print i + 1 < j" " = false"
102 gdb_test "print i + 1 <= j" " = true" 86 gdb_test "print i + 1 <= j" " = true"
103 gdb_test "print i + 1 > j" " = false" 87 gdb_test "print i + 1 > j" " = false"
104 gdb_test "print i + 1 >= j" " = true" 88 gdb_test "print i + 1 >= j" " = true"
105 89
106 # Test multiplication 90 # Test multiplication
107 gdb_test "print 2 * i" " = 2" 91 gdb_test "print 2 * i" " = 2"
108 gdb_test "print j * k" " = 6" 92 gdb_test "print j * k" " = 6"
109 gdb_test "print 3000*i" " = 3000" 93 gdb_test "print 3000*i" " = 3000"
110 94
111 #Test div and mod operators 95 #Test div and mod operators
112 gdb_test "print 35 div 2" " = 17" 96 gdb_test "print 35 / 2" " = 17"
113 gdb_test "print 35 mod 2" " = 1" 97 gdb_test "print 35 % 2" " = 1"
114 98
115 # Test several operators together 99 # Test several operators together
116 gdb_test "print i+10*j+100*k" " = 321" 100 gdb_test "print i+10*j+100*k" " = 321"
117 gdb_test " print (i + 5) * (j + 7)" " = 54" 101 gdb_test " print (i + 5) * (j + 7)" " = 54"
118 102
119 # 'set i' does not work, as there are set sub-commands starting with 'i' 103 gdb_test "set var i = 2" " = 2"
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" 104 gdb_test "print i" " = 2" "Testing new i value"
123 105
106 if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
107 pass "setting breakpoint 2"
108 }
109
124 gdb_test "cont" \ 110 gdb_test "cont" \
125 "Breakpoint .*:${bp_location2}.*" \ 111 "Breakpoint .*:${bp_location2}.*" \
126 "Going to second breakpoint" 112 "Going to second breakpoint"
127 gdb_test "print i" \ 113 gdb_test "print i" \
128 ".* = 5.*" \ 114 ".* = 5.*" \
129 "Value of i after assignment" 115 "Value of i after assignment"
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.go/hello.go ('k') | gdb/testsuite/gdb.go/integers.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698