]>
Commit | Line | Data |
---|---|---|
c906108c SS |
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 | # [email protected] | |
19 | ||
20 | # This test was written by Rich Title. | |
21 | # Purpose is to test conditional breakpoints. | |
22 | # Modeled after "break.exp". | |
23 | ||
24 | ||
25 | ||
26 | if $tracelevel then { | |
27 | strace $tracelevel | |
28 | } | |
29 | ||
30 | global usestubs | |
31 | ||
32 | # | |
33 | # test running programs | |
34 | # | |
35 | set prms_id 0 | |
36 | set bug_id 0 | |
37 | ||
38 | set testfile "condbreak" | |
39 | set srcfile ${testfile}.c | |
40 | set binfile ${objdir}/${subdir}/${testfile} | |
41 | ||
42 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { | |
43 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
44 | } | |
45 | ||
085dd6e6 JM |
46 | if [get_compiler_info ${binfile}] { |
47 | return -1; | |
48 | } | |
49 | ||
c906108c SS |
50 | gdb_exit |
51 | gdb_start | |
52 | gdb_reinitialize_dir $srcdir/$subdir | |
53 | gdb_load ${binfile} | |
54 | ||
55 | ||
56 | if [target_info exists gdb_stub] { | |
57 | gdb_step_for_stub; | |
58 | } | |
59 | ||
60 | # | |
61 | # test break at function | |
62 | # | |
63 | gdb_test "break main" \ | |
64 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
65 | "breakpoint function" | |
66 | ||
67 | # | |
68 | # test conditional break at function | |
69 | # | |
70 | gdb_test "break marker1 if 1==1" \ | |
71 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
72 | "break function if condition" | |
73 | ||
74 | gdb_test "delete 2" \ | |
75 | "" \ | |
76 | "delete break" | |
77 | ||
78 | # | |
79 | # test conditional break at line number | |
80 | # | |
085dd6e6 JM |
81 | gdb_test "break 79 if 1==1" \ |
82 | "Breakpoint.*at.* file .*$srcfile, line 79\\." \ | |
c906108c SS |
83 | "break line if condition" |
84 | ||
85 | gdb_test "delete 3" \ | |
86 | "" \ | |
87 | "delete break" | |
88 | ||
89 | # | |
90 | # test conditional break at function | |
91 | # | |
92 | gdb_test "break marker1 if (1==1)" \ | |
93 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
94 | "break function if (condition)" | |
95 | ||
96 | # | |
97 | # test conditional break at line number | |
98 | # | |
085dd6e6 JM |
99 | gdb_test "break 79 if (1==1)" \ |
100 | "Breakpoint.*at.* file .*$srcfile, line 79\\." \ | |
c906108c SS |
101 | "break line if (condition)" |
102 | ||
103 | gdb_test "break marker2 if (a==43)" \ | |
104 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
105 | "break function if (condition)" | |
106 | ||
107 | # | |
108 | # check to see what breakpoints are set | |
109 | # | |
110 | ||
085dd6e6 JM |
111 | if {$hp_aCC_compiler} { |
112 | set marker1_proto "\\(void\\)" | |
113 | set marker2_proto "\\(int\\)" | |
114 | } else { | |
115 | set marker1_proto "" | |
116 | set marker2_proto "" | |
117 | } | |
118 | ||
119 | set main_line 75 | |
c906108c SS |
120 | gdb_test "info break" \ |
121 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
122 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* | |
085dd6e6 | 123 | \[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].* |
c906108c | 124 | \[\t \]+stop only if 1 == 1.* |
085dd6e6 | 125 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* |
c906108c | 126 | \[\t \]+stop only if 1 == 1.* |
085dd6e6 | 127 | \[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].* |
c906108c SS |
128 | \[\t \]+stop only if a == 43.*" \ |
129 | "breakpoint info" | |
130 | ||
131 | ||
132 | # | |
7a292a7a | 133 | # run until the breakpoint at main is hit. |
c906108c | 134 | # |
7a292a7a SS |
135 | |
136 | ||
cce74817 | 137 | rerun_to_main |
c906108c SS |
138 | |
139 | # | |
140 | # run until the breakpoint at a line number | |
141 | # | |
085dd6e6 | 142 | gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ |
c906108c SS |
143 | "run until breakpoint set at a line number" |
144 | ||
145 | # | |
146 | # run until the breakpoint at marker1 | |
147 | # | |
085dd6e6 | 148 | gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*" \ |
c906108c SS |
149 | "run until breakpoint at marker1" |
150 | ||
151 | # | |
152 | # run until the breakpoint at marker2 | |
153 | # | |
085dd6e6 JM |
154 | #See 11512CLLbs |
155 | setup_xfail hppa2.0w-*-* | |
156 | gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" \ | |
c906108c SS |
157 | "run until breakpoint at marker2" |
158 | ||
159 | ||
160 | ||
161 | ||
162 | ||
163 | ||
164 | ||
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | ||
171 |