Commit | Line | Data |
---|---|---|
bdb7b085 JM |
1 | # Copyright (C) 1997, 1998 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 | # use this to debug: | |
21 | # | |
22 | #log_user 1 | |
23 | ||
24 | # step-test.exp -- Expect script to test stepping in gdb | |
25 | ||
26 | if $tracelevel then { | |
27 | strace $tracelevel | |
28 | } | |
29 | ||
30 | set testfile step-test | |
31 | set srcfile ${srcdir}/${subdir}/${testfile}.c | |
32 | set binfile ${objdir}/${subdir}/${testfile} | |
33 | ||
34 | remote_exec build "rm -f ${binfile}" | |
35 | if { [gdb_compile "${srcfile}" "${binfile}" executable {debug}] != "" } { | |
36 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
37 | } | |
38 | ||
39 | gdb_exit | |
40 | gdb_start | |
41 | gdb_reinitialize_dir $srcdir/$subdir | |
42 | gdb_load ${binfile} | |
43 | ||
44 | if ![runto_main] then { | |
45 | fail "Can't run to main" | |
46 | return 0 | |
47 | } | |
48 | ||
49 | # Vanilla step/next | |
50 | # | |
51 | gdb_test "next" ".*15.*x = 1;.*" "next 1" | |
52 | gdb_test "step" ".*16.*y = 2;.*" "step 1" | |
53 | ||
54 | # With count | |
55 | # | |
56 | gdb_test "next 2" ".*18.*w = w.*2;.*" "next 2" | |
57 | gdb_test "step 3" ".*21.*z = z.*5;.*" "step 3" | |
58 | gdb_test "next" ".*24.*callee.*OVER.*" "next 3" | |
59 | ||
60 | # Step over call | |
61 | # | |
62 | gdb_test "next" ".*27.*callee.*INTO.*" "next over" | |
63 | ||
64 | # Step into call | |
65 | # | |
66 | gdb_test "step" ".*6.*glob.*" "step into" | |
67 | ||
68 | # Step out of call | |
69 | # | |
70 | gdb_test "finish" ".*30.*a.*5.*= a.*3.*" "step out" | |
71 | ||
72 | # Instruction stepping, into | |
73 | # | |
74 | gdb_test "stepi" ".*30.*a.*5.* = a.*3.*" "stepi 1" | |
75 | gdb_test "stepi" ".*30.*a\\\[5\\\] = a.*" "stepi 2" | |
76 | ||
77 | gdb_test "stepi 7" ".*6.*glob.*" "stepi into" | |
78 | gdb_test "finish" ".*34.*callee.*NEXTI.*" "stepi out" | |
79 | ||
80 | # Instruction stepping, over | |
81 | # | |
82 | gdb_test "nexti" ".*callee.*NEXTI.*" "nexti 1" | |
83 | ||
84 | gdb_test "c" ".*Program exited normally.*" "run to finish" | |
85 | ||
86 | return 0 |