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/] [gdbvars.exp] - Blame information for rev 231

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright (C) 1992, 1997, 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 Fred Fish. (fnf@cygnus.com)
18
 
19
if $tracelevel then {
20
        strace $tracelevel
21
}
22
 
23
set prms_id 0
24
set bug_id 0
25
 
26
set testfile "gdbvars"
27
set srcfile  ${testfile}.c
28
set binfile  ${objdir}/${subdir}/${testfile}
29
 
30
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
31
    untested gdbvars.exp
32
    return -1
33
}
34
 
35
proc test_convenience_variables {} {
36
    global gdb_prompt
37
 
38
    gdb_test "set \$foo = 101"  "" \
39
        "Set a new convenience variable"
40
 
41
    gdb_test "print \$foo"              " = 101" \
42
        "Print contents of new convenience variable"
43
 
44
    gdb_test "set \$foo = 301"  "" \
45
        "Set convenience variable to a new value"
46
 
47
    gdb_test "print \$foo"              " = 301" \
48
        "Print new contents of convenience variable"
49
 
50
    gdb_test "set \$_ = 11"             "" \
51
        "Set convenience variable \$_"
52
 
53
    gdb_test "print \$_"                " = 11" \
54
        "Print contents of convenience variable \$_"
55
 
56
    gdb_test "print \$foo + 10" " = 311" \
57
        "Use convenience variable in arithmetic expression"
58
 
59
    gdb_test "print (\$foo = 32) + 4"   " = 36" \
60
        "Use convenience variable assignment in arithmetic expression"
61
 
62
    gdb_test "print \$bar"              " = void" \
63
        "Print contents of uninitialized convenience variable"
64
}
65
 
66
proc test_value_history {} {
67
    global gdb_prompt
68
 
69
    gdb_test "print 101"        "\\\$1 = 101" \
70
        "Set value-history\[1\] using \$1"
71
 
72
    gdb_test "print 102"        "\\\$2 = 102" \
73
        "Set value-history\[2\] using \$2"
74
 
75
    gdb_test "print 103"        "\\\$3 = 103" \
76
        "Set value-history\[3\] using \$3"
77
 
78
    gdb_test "print \$\$"       "\\\$4 = 102" \
79
        "Print value-history\[MAX-1\] using inplicit index \$\$"
80
 
81
    gdb_test "print \$\$"       "\\\$5 = 103" \
82
        "Print value-history\[MAX-1\] again using implicit index \$\$"
83
 
84
    gdb_test "print \$" "\\\$6 = 103" \
85
        "Print value-history\[MAX\] using implicit index \$"
86
 
87
    gdb_test "print \$\$2"      "\\\$7 = 102" \
88
        "Print value-history\[MAX-2\] using explicit index \$\$2"
89
 
90
    gdb_test "print \$0"        "\\\$8 = 102" \
91
        "Print value-history\[MAX\] using explicit index \$0"
92
 
93
    gdb_test "print 108"        "\\\$9 = 108"
94
 
95
    gdb_test "print \$\$0"      "\\\$10 = 108" \
96
        "Print value-history\[MAX\] using explicit index \$\$0"
97
 
98
    gdb_test "print \$1"        "\\\$11 = 101" \
99
        "Print value-history\[1\] using explicit index \$1"
100
 
101
    gdb_test "print \$2"        "\\\$12 = 102" \
102
        "Print value-history\[2\] using explicit index \$2"
103
 
104
    gdb_test "print \$3"        "\\\$13 = 103" \
105
        "Print value-history\[3\] using explicit index \$3"
106
 
107
    gdb_test "print \$-3"       "\\\$14 = 100" \
108
        "Print (value-history\[MAX\] - 3) using implicit index \$"
109
 
110
    gdb_test "print \$1 + 3"    "\\\$15 = 104" \
111
        "Use value-history element in arithmetic expression"
112
}
113
 
114
proc test_with_program {} {
115
    global hex
116
    gdb_test "set \$prog_var = p" "" \
117
        "Set a new convenience variable to a program variable"
118
    gdb_test "print /x \$prog_var" " = $hex" \
119
        "Print contents of new convenience variable of program variable"
120
}
121
 
122
# Start with a fresh gdb.
123
 
124
gdb_exit
125
gdb_start
126
gdb_reinitialize_dir $srcdir/$subdir
127
gdb_load ${binfile}
128
 
129
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re ".*$gdb_prompt $"
130
 
131
test_value_history
132
test_convenience_variables
133
test_with_program

powered by: WebSVN 2.1.0

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