]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-reverse.exp
Check number of sections overflow
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-reverse.exp
CommitLineData
0b302171 1# Copyright 2009, 2011-2012 Free Software Foundation, Inc.\r
fa19b4e5
MS
2\r
3# This program is free software; you can redistribute it and/or modify\r
4# it under the terms of the GNU General Public License as published by\r
5# the Free Software Foundation; either version 3 of the License, or\r
6# (at your option) any later version.\r
7#\r
8# This program is distributed in the hope that it will be useful,\r
9# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
11# GNU General Public License for more details.\r
12#\r
13# You should have received a copy of the GNU General Public License\r
14# along with this program. If not, see <http://www.gnu.org/licenses/>.\r
15\r
16# Test Machine interface (MI) operations\r
17# Verify that, using the MI, we can run a simple program in both forward\r
18# and reverse directions with the following execution commands:\r
19# - exec-continue\r
20# - exec-finish\r
21# - exec-next\r
22# - exec-step\r
23# - exec-next-instruction\r
24# - exec-step-instruction\r
25\r
26# The goal is not to test gdb functionality, which is done by other tests,\r
27# but to verify the correct output response to MI operations.\r
28#\r
29\r
30if ![target_info exists gdb,can_reverse] {\r
31 return\r
32}\r
33\r
34load_lib mi-support.exp\r
35set MIFLAGS "-i=mi"\r
36\r
37gdb_exit\r
38if [mi_gdb_start] {\r
39 continue\r
40}\r
41\r
3b48433d
PA
42set testfile mi-reverse\r
43set srcfile basics.c\r
fa19b4e5
MS
44set binfile ${objdir}/${subdir}/mi2-reverse\r
45if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {\r
3b48433d 46 untested ${testfile}.exp\r
fa19b4e5
MS
47 return -1\r
48}\r
49\r
50mi_run_to_main\r
51\r
52if [target_info exists gdb,use_precord] {\r
53 # Activate process record/replay\r
54 if [mi_gdb_test "-interpreter-exec console record" \\r
55 {\^done} "Turn on process record"] {\r
56 warning "Fail to activate process record/replay, tests in this group will not be performed.\n";\r
57 return -1\r
58 }\r
59}\r
60\r
61# Locate line numbers in basics.c.\r
62set line_callee4_head [gdb_get_line_number "callee4 ("]\r
63set line_callee4_body [expr $line_callee4_head + 2]\r
64set line_callee3_head [gdb_get_line_number "callee3 ("]\r
65set line_callee3_body [expr $line_callee3_head + 2]\r
66set line_callee3_close [expr $line_callee3_head + 3]\r
67set line_callee2_head [gdb_get_line_number "callee2 ("]\r
68set line_callee2_body [expr $line_callee2_head + 2]\r
69set line_callee2_close [expr $line_callee2_head + 3]\r
70set line_callee1_head [gdb_get_line_number "callee1 ("]\r
71set line_callee1_body [expr $line_callee1_head + 2]\r
72set line_callee1_close [expr $line_callee1_head + 3]\r
73set line_callme_head [gdb_get_line_number "callme"]\r
74set line_callme_body [expr $line_callme_head + 2]\r
75set line_main_head [gdb_get_line_number "main ("]\r
76set line_main_body [expr $line_main_head + 2]\r
77set line_main_hello [gdb_get_line_number "Hello, World!"]\r
78set line_main_callme_1 [gdb_get_line_number "callme (1"]\r
79\r
80# Forward execute to the callme() function, so that we can\r
81# execute backward from there.\r
82mi_continue_to callme\r
83mi_delete_breakpoints\r
84\r
85proc test_controlled_execution_reverse {} {\r
86 global mi_gdb_prompt\r
87 global srcfile\r
88 global hex\r
89\r
90 global line_callee4_head line_callee4_body\r
91 global line_callee3_head line_callee3_body line_callee3_close\r
92 global line_callee2_head line_callee2_body line_callee2_close\r
93 global line_callee1_head line_callee1_body line_callee1_close\r
94 global line_main_head line_main_body\r
95 global line_main_hello line_main_callme_1\r
96\r
97 # Test exec-reverse-finish\r
98\r
99 mi_execute_to "exec-finish --reverse" \\r
100 "end-stepping-range" "main" "" \\r
101 "basics.c" $line_main_callme_1 "" \\r
102 "reverse finish from callme"\r
103\r
104 # Test exec-reverse-next\r
105 # It takes two steps to get back to the previous line,\r
106 # as the first step moves us to the start of the current line,\r
107 # and the one after that moves back to the previous line.\r
108\r
109 mi_execute_to "exec-next --reverse 2" \\r
110 "end-stepping-range" "main" "" \\r
111 "basics.c" $line_main_hello "" \\r
112 "reverse next to get over the call to do_nothing"\r
113\r
114 # Test exec-reverse-step\r
115\r
116 mi_execute_to "exec-step --reverse" \\r
117 "end-stepping-range" "callee1" \\r
118 "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \\r
119 "basics.c" $line_callee1_close "" \\r
120 "reverse step to callee1"\r
121\r
122 mi_execute_to "exec-step --reverse" \\r
123 "end-stepping-range" "callee2" \\r
124 "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\}" \\r
125 "basics.c" $line_callee2_close "" \\r
126 "reverse step to callee2"\r
127\r
128 mi_execute_to "exec-step --reverse" \\r
129 "end-stepping-range" "callee3" \\r
130 "\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\}" \\r
131 "basics.c" $line_callee3_close "" \\r
132 "reverse step to callee3"\r
133\r
134 mi_execute_to "exec-step --reverse" \\r
135 "end-stepping-range" "callee4" "" \\r
136 "basics.c" "\[0-9\]+" "" \\r
137 "reverse step to callee4"\r
138\r
139 # Test exec-reverse-[step|next]-instruction\r
140\r
141 mi_execute_to "exec-step-instruction --reverse" \\r
142 "end-stepping-range" "callee4" "" \\r
143 "basics.c" "\[0-9\]+" "" \\r
144 "reverse-step-instruction at callee4"\r
145\r
146 mi_execute_to "exec-next-instruction --reverse" \\r
147 "end-stepping-range" "callee4" "" \\r
148 "basics.c" "\[0-9\]+" "" \\r
149 "reverse-next-instruction at callee4"\r
150\r
151 # Test exec-reverse-continue\r
152\r
153 mi_create_breakpoint "-t basics.c:$line_callee3_head" \\r
154 3 del callee3 ".*basics.c" $line_callee3_head $hex \\r
155 "insert temp breakpoint at basics.c:$line_callee3_head"\r
156\r
157 mi_execute_to "exec-continue --reverse" \\r
158 "breakpoint-hit" "callee3" \\r
159 "\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\}" \\r
160 "basics.c" "\[0-9\]+" \\r
161 { "" "disp=\"del\""} \\r
162 "reverse-continue at callee3"\r
163\r
164 mi_execute_to "exec-continue --reverse" \\r
165 "" "main" "" \\r
166 "basics.c" $line_main_body "" \\r
167 "reverse-continue at main"\r
168}\r
169\r
170test_controlled_execution_reverse\r
171\r
172mi_gdb_exit\r
173return 0\r