]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-6.3-bz140532-ppc-unwinding-test.patch
- typo
[packages/gdb.git] / gdb-6.3-bz140532-ppc-unwinding-test.patch
1 diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
2 --- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S       1969-12-31 19:00:00.000000000 -0500
3 +++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 2007-08-02 13:23:10.000000000 -0400
4 @@ -0,0 +1,78 @@
5 +/* This testcase is part of GDB, the GNU debugger.
6 +
7 +   Copyright 2007 Free Software Foundation, Inc.
8 +
9 +   This program is free software; you can redistribute it and/or modify
10 +   it under the terms of the GNU General Public License as published by
11 +   the Free Software Foundation; either version 2 of the License, or
12 +   (at your option) any later version.
13 +
14 +   This program is distributed in the hope that it will be useful,
15 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
16 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 +   GNU General Public License for more details.
18
19 +   You should have received a copy of the GNU General Public License
20 +   along with this program; if not, write to the Free Software
21 +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 +
23 +       .section        ".text"
24 +       .align 2
25 +       .globl func0
26 +       .type   func0, @function
27 +func0:
28 +       stwu 1,-16(1)
29 +       mflr 0
30 +       stw 31,12(1)
31 +       stw 0,20(1)
32 +       mr 31,1
33 +       bl abort
34 +       .size   func0, .-func0
35 +       .align 2
36 +       .globl func1
37 +       .type   func1, @function
38 +func1:
39 +       stwu 1,-16(1)
40 +       mflr 0
41 +/* 20 = BO = branch always
42 +   31 = BI = CR bit (ignored)  */
43 +       bcl 20,31,.Lpie
44 +.Lpie: stw 31,12(1)
45 +       stw 0,20(1)
46 +       mr 31,1
47 +       bl func0
48 +       mr 0,3
49 +       lis 9,var@ha
50 +       lwz 9,var@l(9)
51 +       add 0,0,9
52 +       mr 3,0
53 +       lwz 11,0(1)
54 +       lwz 0,4(11)
55 +       mtlr 0
56 +       lwz 31,-4(11)
57 +       mr 1,11
58 +       blr
59 +       .size   func1, .-func1
60 +       .section        .note.GNU-stack,"",@progbits
61 +       .ident  "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
62 +
63 +/* Original source file:
64 +
65 +#include <stdlib.h>
66 +
67 +extern volatile int var;
68 +
69 +int func0 (void) __attribute__((__noinline__));
70 +int func0 (void)
71 +{
72 +  abort ();
73 +  return var;
74 +}
75 +
76 +int func1 (void) __attribute__((__noinline__));
77 +int func1 (void)
78 +{
79 +  return func0 () + var;
80 +}
81 +
82 +*/
83 diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
84 --- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S       1969-12-31 19:00:00.000000000 -0500
85 +++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 2007-08-02 14:28:56.000000000 -0400
86 @@ -0,0 +1,98 @@
87 +/* This testcase is part of GDB, the GNU debugger.
88 +
89 +   Copyright 2007 Free Software Foundation, Inc.
90 +
91 +   This program is free software; you can redistribute it and/or modify
92 +   it under the terms of the GNU General Public License as published by
93 +   the Free Software Foundation; either version 2 of the License, or
94 +   (at your option) any later version.
95 +
96 +   This program is distributed in the hope that it will be useful,
97 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
98 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99 +   GNU General Public License for more details.
100
101 +   You should have received a copy of the GNU General Public License
102 +   along with this program; if not, write to the Free Software
103 +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
104 +
105 +       .section        ".toc","aw"
106 +       .section        ".text"
107 +       .align 2
108 +       .globl func0
109 +       .section        ".opd","aw"
110 +       .align 3
111 +func0:
112 +       .quad   .L.func0,.TOC.@tocbase
113 +       .previous
114 +       .type   func0, @function
115 +.L.func0:
116 +       mflr 0
117 +       std 31,-8(1)
118 +       std 0,16(1)
119 +       stdu 1,-128(1)
120 +       mr 31,1
121 +       bl abort
122 +       nop
123 +       .long 0
124 +       .byte 0,0,0,1,128,1,0,1
125 +       .size   func0,.-.L.func0
126 +       .section        ".toc","aw"
127 +.LC1:
128 +       .tc var[TC],var
129 +       .section        ".text"
130 +       .align 2
131 +       .globl func1
132 +       .section        ".opd","aw"
133 +       .align 3
134 +func1:
135 +       .quad   .L.func1,.TOC.@tocbase
136 +       .previous
137 +       .type   func1, @function
138 +.L.func1:
139 +       mflr 0
140 +/* 20 = BO = branch always
141 +   31 = BI = CR bit (ignored)  */
142 +       bcl 20,31,.Lpie
143 +.Lpie: std 31,-8(1)
144 +       std 0,16(1)
145 +       stdu 1,-128(1)
146 +       mr 31,1
147 +       bl func0
148 +       mr 11,3
149 +       ld 9,.LC1@toc(2)
150 +       lwz 0,0(9)
151 +       add 0,11,0
152 +       extsw 0,0
153 +       mr 3,0
154 +       ld 1,0(1)
155 +       ld 0,16(1)
156 +       mtlr 0
157 +       ld 31,-8(1)
158 +       blr
159 +       .long 0
160 +       .byte 0,0,0,1,128,1,0,1
161 +       .size   func1,.-.L.func1
162 +       .section        .note.GNU-stack,"",@progbits
163 +       .ident  "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
164 +
165 +/* Original source file:
166 +
167 +#include <stdlib.h>
168 +
169 +extern volatile int var;
170 +
171 +int func0 (void) __attribute__((__noinline__));
172 +int func0 (void)
173 +{
174 +  abort ();
175 +  return var;
176 +}
177 +
178 +int func1 (void) __attribute__((__noinline__));
179 +int func1 (void)
180 +{
181 +  return func0 () + var;
182 +}
183 +
184 +*/
185 diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
186 --- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c     1969-12-31 19:00:00.000000000 -0500
187 +++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c       2007-08-02 13:25:10.000000000 -0400
188 @@ -0,0 +1,29 @@
189 +/* This testcase is part of GDB, the GNU debugger.
190 +
191 +   Copyright 2007 Free Software Foundation, Inc.
192 +
193 +   This program is free software; you can redistribute it and/or modify
194 +   it under the terms of the GNU General Public License as published by
195 +   the Free Software Foundation; either version 2 of the License, or
196 +   (at your option) any later version.
197 +
198 +   This program is distributed in the hope that it will be useful,
199 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
200 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
201 +   GNU General Public License for more details.
202
203 +   You should have received a copy of the GNU General Public License
204 +   along with this program; if not, write to the Free Software
205 +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
206 +
207 +/* Force `-fpie' double jump bl->blrl.  */
208 +/* No longer used.  */
209 +volatile int var;
210 +
211 +extern int func1 (void);
212 +
213 +int main (void)
214 +{
215 +  func1 ();
216 +  return 0;
217 +}
218 diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
219 --- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp   1969-12-31 19:00:00.000000000 -0500
220 +++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp     2007-08-02 14:21:29.000000000 -0400
221 @@ -0,0 +1,72 @@
222 +#   Copyright 2006, 2007 Free Software Foundation, Inc.
223 +
224 +# This program is free software; you can redistribute it and/or modify
225 +# it under the terms of the GNU General Public License as published by
226 +# the Free Software Foundation; either version 2 of the License, or
227 +# (at your option) any later version.
228 +# 
229 +# This program is distributed in the hope that it will be useful,
230 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
231 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
232 +# GNU General Public License for more details.
233 +# 
234 +# You should have received a copy of the GNU General Public License
235 +# along with this program; if not, write to the Free Software
236 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
237 +
238 +# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
239 +# jump of the PIE code.
240 +
241 +if ![istarget "powerpc*-*-linux*"] then {
242 +    verbose "Skipping powerpc-linux prologue tests."
243 +    return
244 +}
245 +
246 +set testfile "powerpc-bcl-prologue"
247 +set srcfile1 ${testfile}.c
248 +set flags "debug"
249 +if [istarget "powerpc-*"] then {
250 +    set srcfile2 ${testfile}-asm32.S
251 +    set flags "$flags additional_flags=-m32"
252 +} elseif [istarget "powerpc64-*"] then {
253 +    set srcfile2 ${testfile}-asm64.S
254 +    set flags "$flags additional_flags=-m64"
255 +} else {
256 +   fail "powerpc arch test"
257 +   return
258 +}
259 +set objfile2 ${objdir}/${subdir}/${testfile}-asm.o
260 +set binfile ${objdir}/${subdir}/${testfile}
261 +
262 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
263 +    return -1
264 +}
265 +
266 +gdb_exit
267 +gdb_start
268 +gdb_reinitialize_dir $srcdir/$subdir
269 +gdb_load ${binfile}
270 +
271 +# We should stop in abort(3).
272 +
273 +gdb_run_cmd
274 +
275 +gdb_test_multiple {} "continue to abort()" {
276 +    -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
277 +       pass "continue to abort()"
278 +    }
279 +}
280 +
281 +# Check backtrace:
282 +# #3  0x0804835f in func0 ()
283 +# #4  0x0804836a in func1 ()
284 +# #5  0x0804838c in main ()
285 +# (gdb)
286 +# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
287 +
288 +set test "matching unwind"
289 +gdb_test_multiple "backtrace" $test {
290 +    -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
291 +       pass $test
292 +    }
293 +}
294
295 Fixup the testcase for ppc64 biarch GDB.
296
297 --- ./gdb/testsuite/gdb.arch/powerpc-prologue.exp       2008-01-13 13:32:19.000000000 +0100
298 +++ ./gdb/testsuite/gdb.arch/powerpc-prologue.exp       2008-01-02 00:04:10.000000000 +0100
299 @@ -17,8 +17,9 @@
300  # Test PowerPC prologue analyzer.
301  
302  # Do not run on AIX (where we won't be able to build the tests without
303 -# some surgery) or on PowerPC64 (ditto, dot symbols).
304 -if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
305 +# some surgery).  PowerPC64 target would break due to dot symbols but we build
306 +# there PowerPC32 inferior.
307 +if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
308      verbose "Skipping PowerPC prologue tests."
309      return
310  }
This page took 0.048314 seconds and 3 git commands to generate.