]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-6.8-bz466901-backtrace-full-prelinked.patch
- update to 6.8.91.20090930-1 from fedora
[packages/gdb.git] / gdb-6.8-bz466901-backtrace-full-prelinked.patch
1 Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
2
3 Index: gdb-6.8.50.20090909/gdb/dwarf2loc.c
4 ===================================================================
5 --- gdb-6.8.50.20090909.orig/gdb/dwarf2loc.c    2009-09-09 20:08:03.000000000 +0200
6 +++ gdb-6.8.50.20090909/gdb/dwarf2loc.c 2009-09-09 20:10:35.000000000 +0200
7 @@ -56,7 +56,9 @@ find_location_expression (struct dwarf2_
8    CORE_ADDR low, high;
9    gdb_byte *loc_ptr, *buf_end;
10    int length;
11 -  struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
12 +  struct objfile *objfile1 = dwarf2_per_cu_objfile (baton->per_cu);
13 +  struct objfile *objfile = objfile1->separate_debug_objfile
14 +                           ? objfile1->separate_debug_objfile : objfile1;
15    struct gdbarch *gdbarch = get_objfile_arch (objfile);
16    enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
17    unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu);
18 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
19 ===================================================================
20 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
21 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp      2009-09-09 20:10:35.000000000 +0200
22 @@ -0,0 +1,102 @@
23 +# Copyright 2008 Free Software Foundation, Inc.
24 +
25 +# This program is free software; you can redistribute it and/or modify
26 +# it under the terms of the GNU General Public License as published by
27 +# the Free Software Foundation; either version 2 of the License, or
28 +# (at your option) any later version.
29 +# 
30 +# This program is distributed in the hope that it will be useful,
31 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
32 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33 +# GNU General Public License for more details.
34 +# 
35 +# You should have received a copy of the GNU General Public License
36 +# along with this program; if not, write to the Free Software
37 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 +
39 +# Minimal DWARF-2 unit test
40 +
41 +# This test can only be run on i386/x86_64 targets which support DWARF-2.
42 +# For now pick a sampling of likely targets.
43 +if {(![istarget *-*-linux*]
44 +     && ![istarget *-*-gnu*]
45 +     && ![istarget *-*-elf*]
46 +     && ![istarget *-*-openbsd*])
47 +    || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
48 +    return 0  
49 +}
50 +
51 +set testfile "dw2-loclist-prelinked"
52 +set srcfuncfile ${testfile}-func.S
53 +set binsharedfuncfile ${objdir}/${subdir}/${testfile}.so
54 +set srcmainfile ${testfile}-main.c
55 +set binfile ${objdir}/${subdir}/${testfile}
56 +
57 +remote_exec build "rm -f ${binfile}"
58 +
59 +# get the value of gcc_compiled
60 +if [get_compiler_info ${binfile}] {
61 +    return -1
62 +}
63 +
64 +# This test can only be run on gcc as we use additional_flags=FIXME
65 +if {$gcc_compiled == 0} {
66 +    return 0
67 +}
68 +
69 +if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
70 +    untested "Couldn't compile test library"
71 +    return -1
72 +}
73 +
74 +# The new separate debug info file will be stored in the .debug subdirectory.
75 +
76 +if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
77 +    # check that you have a recent version of strip and objcopy installed
78 +    unsupported "cannot produce separate debug info files"
79 +    return -1
80 +}
81 +
82 +if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
83 +    # Maybe we don't have prelink.
84 +    return -1
85 +}
86 +
87 +if  { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
88 +                  "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
89 +    return -1
90 +}
91 +
92 +gdb_exit
93 +gdb_start
94 +gdb_reinitialize_dir $srcdir/$subdir
95 +gdb_load ${binfile}
96 +
97 +gdb_run_cmd
98 +
99 +gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
100 +
101 +# Incorrect:
102 +# #0  0x00110430 in __kernel_vsyscall ()
103 +# No symbol table info available.
104 +# #1  0x003d44c0 in raise () from /lib/libc.so.6
105 +# No symbol table info available.
106 +# #2  0x003d5e88 in abort () from /lib/libc.so.6
107 +# No symbol table info available.
108 +# #3  0x44f10437 in func () at dw2-loclist-prelinked.c:8
109 +#      i = Could not find the frame base for "func".
110 +
111 +# Correct:
112 +# #0  0x00110430 in __kernel_vsyscall ()
113 +# No symbol table info available.
114 +# #1  0x003d44c0 in raise () from /lib/libc.so.6
115 +# No symbol table info available.
116 +# #2  0x003d5e88 in abort () from /lib/libc.so.6
117 +# No symbol table info available.
118 +# #3  0x4ae36437 in func () at dw2-loclist-prelinked.c:8
119 +#      i = 3827288
120 +# #4  0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
121 +# No locals.
122 +
123 +# `abort' can get expressed as `*__GI_abort'.
124 +gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
125 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
126 ===================================================================
127 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
128 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c   2009-09-09 20:10:35.000000000 +0200
129 @@ -0,0 +1,26 @@
130 +/* This testcase is part of GDB, the GNU debugger.
131 +
132 +   Copyright 2008 Free Software Foundation, Inc.
133 +
134 +   This program is free software; you can redistribute it and/or modify
135 +   it under the terms of the GNU General Public License as published by
136 +   the Free Software Foundation; either version 3 of the License, or
137 +   (at your option) any later version.
138 +
139 +   This program is distributed in the hope that it will be useful,
140 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
141 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142 +   GNU General Public License for more details.
143 +
144 +   You should have received a copy of the GNU General Public License
145 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
146 +
147 +/* dw2-loclist-prelinked-func.S */
148 +extern void func (void);
149 +
150 +int
151 +main (void)
152 +{
153 +  func ();
154 +  return 0;
155 +}
156 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
157 ===================================================================
158 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
159 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S   2009-09-09 20:10:35.000000000 +0200
160 @@ -0,0 +1,328 @@
161 +/* This testcase is part of GDB, the GNU debugger.
162 +
163 +   Copyright 2008 Free Software Foundation, Inc.
164 +
165 +   This program is free software; you can redistribute it and/or modify
166 +   it under the terms of the GNU General Public License as published by
167 +   the Free Software Foundation; either version 3 of the License, or
168 +   (at your option) any later version.
169 +
170 +   This program is distributed in the hope that it will be useful,
171 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
172 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
173 +   GNU General Public License for more details.
174 +
175 +   You should have received a copy of the GNU General Public License
176 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
177 +
178 +/*
179 +#include <stdlib.h>
180 +
181 +void
182 +func (void)
183 +{
184 +  int i;
185 +
186 +  abort ();
187 +}
188 +*/
189 +       .file   "dw2-loclist-prelinked.c"
190 +       .section        .debug_abbrev,"",@progbits
191 +.Ldebug_abbrev0:
192 +       .section        .debug_info,"",@progbits
193 +.Ldebug_info0:
194 +       .section        .debug_line,"",@progbits
195 +.Ldebug_line0:
196 +       .text
197 +.Ltext0:
198 +.globl func
199 +       .type   func, @function
200 +func:
201 +.LFB2:
202 +       .file 1 "dw2-loclist-prelinked.c"
203 +       .loc 1 5 0
204 +       pushl   %ebp
205 +.LCFI0:
206 +       movl    %esp, %ebp
207 +.LCFI1:
208 +       subl    $24, %esp
209 +.LCFI2:
210 +       .loc 1 8 0
211 +       call    abort
212 +.LFE2:
213 +       .size   func, .-func
214 +       .section        .debug_frame,"",@progbits
215 +.Lframe0:
216 +       .long   .LECIE0-.LSCIE0
217 +.LSCIE0:
218 +       .long   0xffffffff
219 +       .byte   0x1
220 +       .string ""
221 +       .uleb128 0x1
222 +       .sleb128 -4
223 +       .byte   0x8
224 +       .byte   0xc
225 +       .uleb128 0x4
226 +       .uleb128 0x4
227 +       .byte   0x88
228 +       .uleb128 0x1
229 +       .align 4
230 +.LECIE0:
231 +.LSFDE0:
232 +       .long   .LEFDE0-.LASFDE0
233 +.LASFDE0:
234 +       .long   .Lframe0
235 +       .long   .LFB2
236 +       .long   .LFE2-.LFB2
237 +       .byte   0x4
238 +       .long   .LCFI0-.LFB2
239 +       .byte   0xe
240 +       .uleb128 0x8
241 +       .byte   0x85
242 +       .uleb128 0x2
243 +       .byte   0x4
244 +       .long   .LCFI1-.LCFI0
245 +       .byte   0xd
246 +       .uleb128 0x5
247 +       .align 4
248 +.LEFDE0:
249 +       .text
250 +.Letext0:
251 +       .section        .debug_loc,"",@progbits
252 +.Ldebug_loc0:
253 +.LLST0:
254 +       .long   .LFB2-.Ltext0
255 +       .long   .LCFI0-.Ltext0
256 +       .value  0x2
257 +       .byte   0x74
258 +       .sleb128 4
259 +       .long   .LCFI0-.Ltext0
260 +       .long   .LCFI1-.Ltext0
261 +       .value  0x2
262 +       .byte   0x74
263 +       .sleb128 8
264 +       .long   .LCFI1-.Ltext0
265 +       .long   .LFE2-.Ltext0
266 +       .value  0x2
267 +       .byte   0x75
268 +       .sleb128 8
269 +       .long   0x0
270 +       .long   0x0
271 +       .section        .debug_info
272 +       .long   0x94
273 +       .value  0x2
274 +       .long   .Ldebug_abbrev0
275 +       .byte   0x4
276 +       .uleb128 0x1
277 +       .long   .LASF10
278 +       .byte   0x1
279 +       .long   .LASF11
280 +       .long   .LASF12
281 +       .long   .Ltext0
282 +       .long   .Letext0
283 +       .long   .Ldebug_line0
284 +       .uleb128 0x2
285 +       .byte   0x4
286 +       .byte   0x7
287 +       .long   .LASF0
288 +       .uleb128 0x3
289 +       .byte   0x4
290 +       .byte   0x5
291 +       .string "int"
292 +       .uleb128 0x2
293 +       .byte   0x4
294 +       .byte   0x5
295 +       .long   .LASF1
296 +       .uleb128 0x2
297 +       .byte   0x1
298 +       .byte   0x8
299 +       .long   .LASF2
300 +       .uleb128 0x2
301 +       .byte   0x2
302 +       .byte   0x7
303 +       .long   .LASF3
304 +       .uleb128 0x2
305 +       .byte   0x4
306 +       .byte   0x7
307 +       .long   .LASF4
308 +       .uleb128 0x2
309 +       .byte   0x1
310 +       .byte   0x6
311 +       .long   .LASF5
312 +       .uleb128 0x2
313 +       .byte   0x2
314 +       .byte   0x5
315 +       .long   .LASF6
316 +       .uleb128 0x2
317 +       .byte   0x8
318 +       .byte   0x5
319 +       .long   .LASF7
320 +       .uleb128 0x2
321 +       .byte   0x8
322 +       .byte   0x7
323 +       .long   .LASF8
324 +       .uleb128 0x4
325 +       .byte   0x4
326 +       .byte   0x7
327 +       .uleb128 0x2
328 +       .byte   0x1
329 +       .byte   0x6
330 +       .long   .LASF9
331 +       .uleb128 0x5
332 +       .byte   0x1
333 +       .long   .LASF13
334 +       .byte   0x1
335 +       .byte   0x5
336 +       .byte   0x1
337 +       .long   .LFB2
338 +       .long   .LFE2
339 +       .long   .LLST0
340 +       .uleb128 0x6
341 +       .string "i"
342 +       .byte   0x1
343 +       .byte   0x6
344 +       .long   0x2c
345 +       .byte   0x2
346 +       .byte   0x91
347 +       .sleb128 -12
348 +       .byte   0x0
349 +       .byte   0x0
350 +       .section        .debug_abbrev
351 +       .uleb128 0x1
352 +       .uleb128 0x11
353 +       .byte   0x1
354 +       .uleb128 0x25
355 +       .uleb128 0xe
356 +       .uleb128 0x13
357 +       .uleb128 0xb
358 +       .uleb128 0x3
359 +       .uleb128 0xe
360 +       .uleb128 0x1b
361 +       .uleb128 0xe
362 +       .uleb128 0x11
363 +       .uleb128 0x1
364 +       .uleb128 0x12
365 +       .uleb128 0x1
366 +       .uleb128 0x10
367 +       .uleb128 0x6
368 +       .byte   0x0
369 +       .byte   0x0
370 +       .uleb128 0x2
371 +       .uleb128 0x24
372 +       .byte   0x0
373 +       .uleb128 0xb
374 +       .uleb128 0xb
375 +       .uleb128 0x3e
376 +       .uleb128 0xb
377 +       .uleb128 0x3
378 +       .uleb128 0xe
379 +       .byte   0x0
380 +       .byte   0x0
381 +       .uleb128 0x3
382 +       .uleb128 0x24
383 +       .byte   0x0
384 +       .uleb128 0xb
385 +       .uleb128 0xb
386 +       .uleb128 0x3e
387 +       .uleb128 0xb
388 +       .uleb128 0x3
389 +       .uleb128 0x8
390 +       .byte   0x0
391 +       .byte   0x0
392 +       .uleb128 0x4
393 +       .uleb128 0x24
394 +       .byte   0x0
395 +       .uleb128 0xb
396 +       .uleb128 0xb
397 +       .uleb128 0x3e
398 +       .uleb128 0xb
399 +       .byte   0x0
400 +       .byte   0x0
401 +       .uleb128 0x5
402 +       .uleb128 0x2e
403 +       .byte   0x1
404 +       .uleb128 0x3f
405 +       .uleb128 0xc
406 +       .uleb128 0x3
407 +       .uleb128 0xe
408 +       .uleb128 0x3a
409 +       .uleb128 0xb
410 +       .uleb128 0x3b
411 +       .uleb128 0xb
412 +       .uleb128 0x27
413 +       .uleb128 0xc
414 +       .uleb128 0x11
415 +       .uleb128 0x1
416 +       .uleb128 0x12
417 +       .uleb128 0x1
418 +       .uleb128 0x40
419 +       .uleb128 0x6
420 +       .byte   0x0
421 +       .byte   0x0
422 +       .uleb128 0x6
423 +       .uleb128 0x34
424 +       .byte   0x0
425 +       .uleb128 0x3
426 +       .uleb128 0x8
427 +       .uleb128 0x3a
428 +       .uleb128 0xb
429 +       .uleb128 0x3b
430 +       .uleb128 0xb
431 +       .uleb128 0x49
432 +       .uleb128 0x13
433 +       .uleb128 0x2
434 +       .uleb128 0xa
435 +       .byte   0x0
436 +       .byte   0x0
437 +       .byte   0x0
438 +       .section        .debug_pubnames,"",@progbits
439 +       .long   0x17
440 +       .value  0x2
441 +       .long   .Ldebug_info0
442 +       .long   0x98
443 +       .long   0x75
444 +       .string "func"
445 +       .long   0x0
446 +       .section        .debug_aranges,"",@progbits
447 +       .long   0x1c
448 +       .value  0x2
449 +       .long   .Ldebug_info0
450 +       .byte   0x4
451 +       .byte   0x0
452 +       .value  0x0
453 +       .value  0x0
454 +       .long   .Ltext0
455 +       .long   .Letext0-.Ltext0
456 +       .long   0x0
457 +       .long   0x0
458 +       .section        .debug_str,"MS",@progbits,1
459 +.LASF7:
460 +       .string "long long int"
461 +.LASF0:
462 +       .string "unsigned int"
463 +.LASF11:
464 +       .string "dw2-loclist-prelinked.c"
465 +.LASF12:
466 +       .string "gdb-6.8/gdb/testsuite/gdb.dwarf2"
467 +.LASF4:
468 +       .string "long unsigned int"
469 +.LASF8:
470 +       .string "long long unsigned int"
471 +.LASF2:
472 +       .string "unsigned char"
473 +.LASF9:
474 +       .string "char"
475 +.LASF1:
476 +       .string "long int"
477 +.LASF3:
478 +       .string "short unsigned int"
479 +.LASF5:
480 +       .string "signed char"
481 +.LASF10:
482 +       .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
483 +.LASF13:
484 +       .string "func"
485 +.LASF6:
486 +       .string "short int"
487 +       .ident  "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
488 +       .section        .note.GNU-stack,"",@progbits
This page took 0.121842 seconds and 3 git commands to generate.