]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | Test GCORE on 32bit inferiors on 64bit platforms. |
2 | ||
3 | UNSUPPORTED results are valid for `-m64' on 32bit targets. | |
4 | ||
5 | ||
6 | Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp | |
7 | =================================================================== | |
8 | --- gdb-6.8.orig/gdb/testsuite/gdb.base/gcore.exp 2008-01-01 23:53:19.000000000 +0100 | |
9 | +++ gdb-6.8/gdb/testsuite/gdb.base/gcore.exp 2008-07-14 10:28:05.000000000 +0200 | |
10 | @@ -30,9 +30,14 @@ set testfile "gcore" | |
11 | set srcfile ${testfile}.c | |
12 | set binfile ${objdir}/${subdir}/${testfile} | |
13 | ||
14 | -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
15 | - untested gcore.exp | |
16 | - return -1 | |
17 | +# `-static-libgcc' to avoid dependency on `libgcc.{i386,ppc}'. | |
18 | +foreach additional_flags {{} {-m32 -static-libgcc} {-m64 -static-libgcc}} { | |
19 | + | |
20 | +set prefix "arch{$additional_flags}:" | |
21 | + | |
22 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$additional_flags]] != "" } { | |
23 | + unsupported "${prefix} gcore.exp" | |
24 | + continue | |
25 | } | |
26 | ||
27 | # Start with a fresh gdb. | |
28 | @@ -47,23 +52,23 @@ send_gdb "help gcore\n" | |
29 | gdb_expect { | |
30 | -re "Undefined command: .gcore.*$gdb_prompt $" { | |
31 | # gcore command not supported -- nothing to test here. | |
32 | - unsupported "gdb does not support gcore on this target" | |
33 | - return -1; | |
34 | + unsupported "${prefix} gdb does not support gcore on this target" | |
35 | + continue | |
36 | } | |
37 | -re "Save a core file .*$gdb_prompt $" { | |
38 | - pass "help gcore" | |
39 | + pass "${prefix} help gcore" | |
40 | } | |
41 | -re ".*$gdb_prompt $" { | |
42 | - fail "help gcore" | |
43 | + fail "${prefix} help gcore" | |
44 | } | |
45 | timeout { | |
46 | - fail "help gcore (timeout)" | |
47 | + fail "${prefix} help gcore (timeout)" | |
48 | } | |
49 | } | |
50 | ||
51 | if { ! [ runto_main ] } then { | |
52 | - untested gcore.exp | |
53 | - return -1 | |
54 | + untested "${prefix} gcore.exp" | |
55 | + continue | |
56 | } | |
57 | ||
58 | proc capture_command_output { command prefix } { | |
59 | @@ -77,7 +82,7 @@ proc capture_command_output { command pr | |
60 | set output_string $expect_out(1,string) | |
61 | } | |
62 | default { | |
63 | - fail "capture_command_output failed on $command." | |
64 | + fail "${prefix} capture_command_output failed on $command." | |
65 | } | |
66 | } | |
67 | return $output_string | |
68 | @@ -109,22 +114,22 @@ set escapedfilename [string_to_regexp ${ | |
69 | ||
70 | set core_supported 0 | |
71 | gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \ | |
72 | - "save a corefile" \ | |
73 | + "${prefix} save a corefile" \ | |
74 | { | |
75 | -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { | |
76 | - pass "save a corefile" | |
77 | + pass "${prefix} save a corefile" | |
78 | global core_supported | |
79 | set core_supported 1 | |
80 | } | |
81 | -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { | |
82 | - unsupported "save a corefile" | |
83 | + unsupported "${prefix} save a corefile" | |
84 | global core_supported | |
85 | set core_supported 0 | |
86 | } | |
87 | } | |
88 | ||
89 | if {!$core_supported} { | |
90 | - return -1 | |
91 | + continue | |
92 | } | |
93 | ||
94 | # Now restart gdb and load the corefile. | |
95 | @@ -136,31 +141,31 @@ gdb_load ${binfile} | |
96 | send_gdb "core ${objdir}/${subdir}/gcore.test\n" | |
97 | gdb_expect { | |
98 | -re ".* is not a core dump:.*$gdb_prompt $" { | |
99 | - fail "re-load generated corefile (bad file format)" | |
100 | + fail "${prefix} re-load generated corefile (bad file format)" | |
101 | # No use proceeding from here. | |
102 | - return; | |
103 | + continue | |
104 | } | |
105 | -re ".*: No such file or directory.*$gdb_prompt $" { | |
106 | - fail "re-load generated corefile (file not found)" | |
107 | + fail "${prefix} re-load generated corefile (file not found)" | |
108 | # No use proceeding from here. | |
109 | - return; | |
110 | + continue | |
111 | } | |
112 | -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" { | |
113 | - fail "re-load generated corefile (incomplete note section)" | |
114 | + fail "${prefix} re-load generated corefile (incomplete note section)" | |
115 | } | |
116 | -re "Core was generated by .*$gdb_prompt $" { | |
117 | - pass "re-load generated corefile" | |
118 | + pass "${prefix} re-load generated corefile" | |
119 | } | |
120 | -re ".*$gdb_prompt $" { | |
121 | - fail "re-load generated corefile" | |
122 | + fail "${prefix} re-load generated corefile" | |
123 | } | |
124 | timeout { | |
125 | - fail "re-load generated corefile (timeout)" | |
126 | + fail "${prefix} re-load generated corefile (timeout)" | |
127 | } | |
128 | } | |
129 | ||
130 | send_gdb "where\n" | |
131 | -gdb_expect_list "where in corefile" ".*$gdb_prompt $" { | |
132 | +gdb_expect_list "${prefix} where in corefile" ".*$gdb_prompt $" { | |
133 | ".*\[\r\n\]+#0 .* terminal_func \\(\\) at " | |
134 | ".*\[\r\n\]+#1 .* array_func \\(\\) at " | |
135 | ".*\[\r\n\]+#2 .* factorial_func \\(value=1\\) at " | |
136 | @@ -174,61 +179,64 @@ gdb_expect_list "where in corefile" ".*$ | |
137 | ||
138 | set post_corefile_regs [capture_command_output "info registers" ""] | |
139 | if ![string compare $pre_corefile_regs $post_corefile_regs] then { | |
140 | - pass "corefile restored general registers" | |
141 | + pass "${prefix} corefile restored general registers" | |
142 | } else { | |
143 | - fail "corefile restored general registers" | |
144 | + fail "${prefix} corefile restored general registers" | |
145 | } | |
146 | ||
147 | set post_corefile_allregs [capture_command_output "info all-reg" ""] | |
148 | if ![string compare $pre_corefile_allregs $post_corefile_allregs] then { | |
149 | - pass "corefile restored all registers" | |
150 | + pass "${prefix} corefile restored all registers" | |
151 | } else { | |
152 | - fail "corefile restored all registers" | |
153 | + fail "${prefix} corefile restored all registers" | |
154 | } | |
155 | ||
156 | set post_corefile_extern_array \ | |
157 | [capture_command_output "print extern_array" "$print_prefix"] | |
158 | if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] { | |
159 | - pass "corefile restored extern array" | |
160 | + pass "${prefix} corefile restored extern array" | |
161 | } else { | |
162 | - fail "corefile restored extern array" | |
163 | + fail "${prefix} corefile restored extern array" | |
164 | } | |
165 | ||
166 | set post_corefile_static_array \ | |
167 | [capture_command_output "print static_array" "$print_prefix"] | |
168 | if ![string compare $pre_corefile_static_array $post_corefile_static_array] { | |
169 | - pass "corefile restored static array" | |
170 | + pass "${prefix} corefile restored static array" | |
171 | } else { | |
172 | - fail "corefile restored static array" | |
173 | + fail "${prefix} corefile restored static array" | |
174 | } | |
175 | ||
176 | set post_corefile_uninit_array \ | |
177 | [capture_command_output "print un_initialized_array" "$print_prefix"] | |
178 | if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] { | |
179 | - pass "corefile restored un-initialized array" | |
180 | + pass "${prefix} corefile restored un-initialized array" | |
181 | } else { | |
182 | - fail "corefile restored un-initialized array" | |
183 | + fail "${prefix} corefile restored un-initialized array" | |
184 | } | |
185 | ||
186 | set post_corefile_heap_string \ | |
187 | [capture_command_output "print heap_string" "$print_prefix"] | |
188 | if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] { | |
189 | - pass "corefile restored heap array" | |
190 | + pass "${prefix} corefile restored heap array" | |
191 | } else { | |
192 | - fail "corefile restored heap array" | |
193 | + fail "${prefix} corefile restored heap array" | |
194 | } | |
195 | ||
196 | set post_corefile_local_array \ | |
197 | [capture_command_output "print array_func::local_array" "$print_prefix"] | |
198 | if ![string compare $pre_corefile_local_array $post_corefile_local_array] { | |
199 | - pass "corefile restored stack array" | |
200 | + pass "${prefix} corefile restored stack array" | |
201 | } else { | |
202 | - fail "corefile restored stack array" | |
203 | + fail "${prefix} corefile restored stack array" | |
204 | } | |
205 | ||
206 | set post_corefile_backtrace [capture_command_output "backtrace" ""] | |
207 | if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] { | |
208 | - pass "corefile restored backtrace" | |
209 | + pass "${prefix} corefile restored backtrace" | |
210 | } else { | |
211 | - fail "corefile restored backtrace" | |
212 | + fail "${prefix} corefile restored backtrace" | |
213 | +} | |
214 | + | |
215 | +# $additional_flags: | |
216 | } |