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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [gdbvars.exp] - Blame information for rev 1774

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

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1992, 1997 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Fred Fish. (fnf@cygnus.com)
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
proc test_convenience_variables {} {
30
    global gdb_prompt
31
 
32
    gdb_test "set \$foo = 101"  "" \
33
        "Set a new convenience variable"
34
 
35
    gdb_test "print \$foo"              " = 101" \
36
        "Print contents of new convenience variable"
37
 
38
    gdb_test "set \$foo = 301"  "" \
39
        "Set convenience variable to a new value"
40
 
41
    gdb_test "print \$foo"              " = 301" \
42
        "Print new contents of convenience variable"
43
 
44
    gdb_test "set \$_ = 11"             "" \
45
        "Set convenience variable \$_"
46
 
47
    gdb_test "print \$_"                " = 11" \
48
        "Print contents of convenience variable \$_"
49
 
50
    gdb_test "print \$foo + 10" " = 311" \
51
        "Use convenience variable in arithmetic expression"
52
 
53
    gdb_test "print (\$foo = 32) + 4"   " = 36" \
54
        "Use convenience variable assignment in arithmetic expression"
55
 
56
    gdb_test "print \$bar"              " = void" \
57
        "Print contents of uninitialized convenience variable"
58
}
59
 
60
proc test_value_history {} {
61
    global gdb_prompt
62
 
63
    gdb_test "print 101"        "\\\$1 = 101" \
64
        "Set value-history\[1\] using \$1"
65
 
66
    gdb_test "print 102"        "\\\$2 = 102" \
67
        "Set value-history\[2\] using \$2"
68
 
69
    gdb_test "print 103"        "\\\$3 = 103" \
70
        "Set value-history\[3\] using \$3"
71
 
72
    gdb_test "print \$\$"       "\\\$4 = 102" \
73
        "Print value-history\[MAX-1\] using inplicit index \$\$"
74
 
75
    gdb_test "print \$\$"       "\\\$5 = 103" \
76
        "Print value-history\[MAX-1\] again using implicit index \$\$"
77
 
78
    gdb_test "print \$" "\\\$6 = 103" \
79
        "Print value-history\[MAX\] using implicit index \$"
80
 
81
    gdb_test "print \$\$2"      "\\\$7 = 102" \
82
        "Print value-history\[MAX-2\] using explicit index \$\$2"
83
 
84
    gdb_test "print \$0"        "\\\$8 = 102" \
85
        "Print value-history\[MAX\] using explicit index \$0"
86
 
87
    gdb_test "print 108"        "\\\$9 = 108"
88
 
89
    gdb_test "print \$\$0"      "\\\$10 = 108" \
90
        "Print value-history\[MAX\] using explicit index \$\$0"
91
 
92
    gdb_test "print \$1"        "\\\$11 = 101" \
93
        "Print value-history\[1\] using explicit index \$1"
94
 
95
    gdb_test "print \$2"        "\\\$12 = 102" \
96
        "Print value-history\[2\] using explicit index \$2"
97
 
98
    gdb_test "print \$3"        "\\\$13 = 103" \
99
        "Print value-history\[3\] using explicit index \$3"
100
 
101
    gdb_test "print \$-3"       "\\\$14 = 100" \
102
        "Print (value-history\[MAX\] - 3) using implicit index \$"
103
 
104
    gdb_test "print \$1 + 3"    "\\\$15 = 104" \
105
        "Use value-history element in arithmetic expression"
106
}
107
 
108
# Start with a fresh gdb.
109
 
110
gdb_exit
111
gdb_start
112
gdb_reinitialize_dir $srcdir/$subdir
113
 
114
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re ".*$gdb_prompt $"
115
 
116
test_value_history
117
test_convenience_variables

powered by: WebSVN 2.1.0

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