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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.mi/] [mi-regs.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
#   Copyright (C) 1999, 2000 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
# Test essential Machine interface (MI) operations
21
#
22
# Verify that, using the MI, we can run a simple program and look at registers.
23
#
24
# The goal is not to test gdb functionality, which is done by other tests,
25
# but to verify the correct output response to MI operations.
26
#
27
 
28
 
29
load_lib mi-support.exp
30
 
31
gdb_exit
32
if [mi_gdb_start] {
33
    continue
34
}
35
 
36
set testfile "basics"
37
set srcfile ${testfile}.c
38
set binfile ${objdir}/${subdir}/${testfile}
39
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
40
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
41
}
42
 
43
mi_delete_breakpoints
44
mi_gdb_reinitialize_dir $srcdir/$subdir
45
mi_gdb_load ${binfile}
46
 
47
proc test_breakpoints_creation_and_listing {} {
48
    global mi_gdb_prompt
49
    global srcfile
50
    global hex
51
 
52
    # Insert some breakpoints and list them
53
    # Also, disable some so they do not interfere with other tests
54
    # Tests:
55
    # -break-insert
56
    # -break-list
57
    # -break-disable
58
    # -break-info
59
 
60
    mi_gdb_test "200-break-insert main" \
61
             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
62
             "break-insert operation"
63
 
64
    mi_gdb_test "204-break-list" \
65
                "204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\}" \
66
                "list of breakpoints"
67
}
68
 
69
proc test_running_the_program {} {
70
    global mi_gdb_prompt
71
    global hex
72
 
73
    # Run the program without args
74
    # Tests:
75
    # -exec-run
76
 
77
    # mi_gdb_test cannot be used for asynchronous commands because there are
78
    # two prompts involved and this can lead to a race condition.
79
    # FIXME: We are accepting a duplicate file and line info temporarely.
80
    # The following is equivalent to a send_gdb "000-exec-run\n"
81
    mi_run_cmd
82
    # The running part has been checked already by mi_run_cmd
83
        gdb_expect {
84
            -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
85
            pass "run to main"
86
          }
87
          -re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
88
          timeout {fail "run to main (timeout 2)"}
89
        }
90
}
91
 
92
proc sparc_register_tests_no_exec { } {
93
        # Test the generic IDT chip.
94
        mi_gdb_test "111-data-list-register-values" \
95
                ".*111\\^error,msg=\"mi_cmd_data_list_register_values: Usage: -data-list-register-values  \\\[...\\\]\"" \
96
                "wrong arguments"
97
 
98
        mi_gdb_test "111-data-list-register-values x" \
99
                ".*111\\^error,msg=\"mi_cmd_data_list_register_values: No registers\.\"" \
100
                "no executable"
101
}
102
 
103
# These tests exercise IDT-specific MIPS registers for several
104
# different processor models.
105
 
106
# This should detect the actual processor in use and change
107
# the expected results appropriately.  FIXME
108
 
109
proc sparc_register_tests { } {
110
    global hex
111
    global decimal
112
    set octal "\[0-7\]+"
113
    set binary "\[0-1\]+"
114
    set float "-?\[0-9\]+(\.\[0-9\]+)?(e\[+\-\]\[0-9\]+)?"
115
    set float2 "\-?\[0-9\]+"
116
 
117
    mi_gdb_test "111-data-list-register-names" \
118
            "111\\^done,register-names=\{\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
119
            "list register names"
120
 
121
    mi_gdb_test "222-data-list-register-values x" \
122
            "222\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \
123
            "register values x"
124
 
125
    mi_gdb_test "333-data-list-register-values f" \
126
            "333\\^done,register-values=\{\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"71\",value=\"$float\"\}\}" \
127
            "register values f"
128
 
129
    mi_gdb_test "444-data-list-register-values d" \
130
            "444\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \
131
            "register values d"
132
 
133
    mi_gdb_test "555-data-list-register-values o" \
134
            "555\\^done,register-values=\{\{number=\"0\",value=\"$octal\"\}.*\{number=\"71\",value=\"$octal\"\}\}" \
135
            "register values o"
136
 
137
    mi_gdb_test "666-data-list-register-values t" \
138
            "666\\^done,register-values=\{\{number=\"0\",value=\"$binary\"\}.*\{number=\"71\",value=\"$binary\"\}\}" \
139
            "register values t"
140
 
141
    # On the sparc, registers 0-31 are int, 32-63 float, 64-71 int
142
 
143
    mi_gdb_test "777-data-list-register-values N" \
144
            "777\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"31\",value=\"$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \
145
            "register values N"
146
 
147
    mi_gdb_test "888-data-list-register-values r" \
148
            "888\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \
149
            "register values r"
150
 
151
    mi_gdb_test "999-data-list-register-names 68 69 70 71" \
152
            "999\\^done,register-names=\{\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
153
            "list names of some regs"
154
 
155
    mi_gdb_test "001-data-list-register-values x 68 69 70 71" \
156
            "001\\^done,register-values=\{\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\}" \
157
            "list values of some regs"
158
 
159
    # Don't know how useful this test is
160
 
161
    mi_gdb_test "002-data-list-changed-registers" \
162
            "002\\^done,changed-registers=\{\"1\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"30\",\"31\",\"65\",\"68\",\"69\"\}" \
163
            "list changed registers"
164
}
165
 
166
if [istarget "sparc-*-*"] then {
167
    sparc_register_tests_no_exec
168
    test_breakpoints_creation_and_listing
169
    test_running_the_program
170
    sparc_register_tests
171
} else {
172
    verbose "mi-regs.exp tests ignored for this target"
173
}
174
 
175
mi_gdb_exit
176
return 0
177
 
178
# Local variables:
179
# change-log-default-name: "ChangeLog-mi"
180
# End:
181
 
182
 
183
 

powered by: WebSVN 2.1.0

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