1 |
24 |
jeremybenn |
# Copyright 1999, 2000, 2001, 2002, 2003, 2007, 2008
|
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 |
|
|
# 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 |
|
|
set MIFLAGS "-i=mi2"
|
31 |
|
|
|
32 |
|
|
gdb_exit
|
33 |
|
|
if [mi_gdb_start] {
|
34 |
|
|
continue
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
set testfile "basics"
|
38 |
|
|
set srcfile ${testfile}.c
|
39 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
40 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
41 |
|
|
untested mi2-regs.exp
|
42 |
|
|
return -1
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
proc sparc_register_tests_no_exec { } {
|
46 |
|
|
# Test the generic IDT chip.
|
47 |
|
|
mi_gdb_test "111-data-list-register-values" \
|
48 |
|
|
".*111\\^error,msg=\"mi_cmd_data_list_register_values: Usage: -data-list-register-values \\\[...\\\]\"" \
|
49 |
|
|
"wrong arguments"
|
50 |
|
|
|
51 |
|
|
mi_gdb_test "111-data-list-register-values x" \
|
52 |
|
|
".*111\\^error,msg=\"No registers\.\"" \
|
53 |
|
|
"no executable"
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
# These tests exercise IDT-specific MIPS registers for several
|
57 |
|
|
# different processor models.
|
58 |
|
|
|
59 |
|
|
# This should detect the actual processor in use and change
|
60 |
|
|
# the expected results appropriately. FIXME
|
61 |
|
|
|
62 |
|
|
proc sparc_register_tests { } {
|
63 |
|
|
global hex
|
64 |
|
|
global decimal
|
65 |
|
|
set octal "\[0-7\]+"
|
66 |
|
|
set binary "\[0-1\]+"
|
67 |
|
|
set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))"
|
68 |
|
|
set float2 "\\-?\[0-9\]+"
|
69 |
|
|
|
70 |
|
|
mi_gdb_test "111-data-list-register-names" \
|
71 |
|
|
"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\",\"fsr\",\"csr\",\"d0\",\"d2\",\"d4\",\"d6\",\"d8\",\"d10\",\"d12\",\"d14\",\"d16\",\"d18\",\"d20\",\"d22\",\"d24\",\"d26\",\"d28\",\"d30\"\\\]" \
|
72 |
|
|
"list register names"
|
73 |
|
|
|
74 |
|
|
mi_gdb_test "222-data-list-register-values x" \
|
75 |
|
|
"222\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \
|
76 |
|
|
"register values x"
|
77 |
|
|
|
78 |
|
|
mi_gdb_test "333-data-list-register-values f" \
|
79 |
|
|
"333\\^done,register-values=\\\[\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"87\",value=\"$float\"\}\\\]" \
|
80 |
|
|
"register values f"
|
81 |
|
|
|
82 |
|
|
mi_gdb_test "444-data-list-register-values d" \
|
83 |
|
|
"444\\^done,register-values=\\\[\{number=\"0\",value=\"-?$decimal\"\}.*\{number=\"87\",value=\"-?$decimal\"\}\\\]" \
|
84 |
|
|
"register values d"
|
85 |
|
|
|
86 |
|
|
mi_gdb_test "555-data-list-register-values o" \
|
87 |
|
|
"555\\^done,register-values=\\\[\{number=\"0\",value=\"$octal\"\}.*\{number=\"87\",value=\"$octal\"\}\\\]" \
|
88 |
|
|
"register values o"
|
89 |
|
|
|
90 |
|
|
mi_gdb_test "666-data-list-register-values t" \
|
91 |
|
|
"666\\^done,register-values=\\\[\{number=\"0\",value=\"$binary\"\}.*\{number=\"87\",value=\"$binary\"\}\\\]" \
|
92 |
|
|
"register values t"
|
93 |
|
|
|
94 |
|
|
# On the sparc, registers 0-31 are int, 32-63 float, 64-71 int, 72-87 float
|
95 |
|
|
|
96 |
|
|
mi_gdb_test "777-data-list-register-values N" \
|
97 |
|
|
"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\"\},\{number=\"72\",value=\"$float\"\}.*\{number=\"87\",value=\"$float\"\}\\\]" \
|
98 |
|
|
"register values N"
|
99 |
|
|
|
100 |
|
|
mi_gdb_test "888-data-list-register-values r" \
|
101 |
|
|
"888\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \
|
102 |
|
|
"register values r"
|
103 |
|
|
|
104 |
|
|
mi_gdb_test "999-data-list-register-names 68 69 70 71" \
|
105 |
|
|
"999\\^done,register-names=\\\[\"pc\",\"npc\",\"fsr\",\"csr\"\\\]" \
|
106 |
|
|
"list names of some regs"
|
107 |
|
|
|
108 |
|
|
mi_gdb_test "001-data-list-register-values x 68 69 70 71" \
|
109 |
|
|
"001\\^done,register-values=\\\[\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\\\]" \
|
110 |
|
|
"list values of some regs"
|
111 |
|
|
|
112 |
|
|
mi_gdb_test "002-data-list-changed-registers" \
|
113 |
|
|
"002\\^done,changed-registers=\\\[(\"${decimal}\"(,\"${decimal}\")*)?\\\]" \
|
114 |
|
|
"list changed registers"
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
if [istarget "sparc-*-*"] then {
|
118 |
|
|
sparc_register_tests_no_exec
|
119 |
|
|
mi_run_to_main
|
120 |
|
|
sparc_register_tests
|
121 |
|
|
} else {
|
122 |
|
|
verbose "mi-regs.exp tests ignored for this target"
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
mi_gdb_exit
|
126 |
|
|
return 0
|