1 Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
3 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
4 ===================================================================
5 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp 2009-09-09 20:10:35.000000000 +0200
8 +# Copyright 2008 Free Software Foundation, Inc.
10 +# This program is free software; you can redistribute it and/or modify
11 +# it under the terms of the GNU General Public License as published by
12 +# the Free Software Foundation; either version 2 of the License, or
13 +# (at your option) any later version.
15 +# This program is distributed in the hope that it will be useful,
16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 +# GNU General Public License for more details.
20 +# You should have received a copy of the GNU General Public License
21 +# along with this program; if not, write to the Free Software
22 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 +# Minimal DWARF-2 unit test
26 +# This test can only be run on i386/x86_64 targets which support DWARF-2.
27 +# For now pick a sampling of likely targets.
28 +if {(![istarget *-*-linux*]
29 + && ![istarget *-*-gnu*]
30 + && ![istarget *-*-elf*]
31 + && ![istarget *-*-openbsd*])
32 + || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
36 +set testfile "dw2-loclist-prelinked"
37 +set srcfuncfile ${testfile}-func.S
38 +set binsharedfuncfile ${objdir}/${subdir}/${testfile}.so
39 +set srcmainfile ${testfile}-main.c
40 +set binfile ${objdir}/${subdir}/${testfile}
42 +remote_exec build "rm -f ${binfile}"
44 +# get the value of gcc_compiled
45 +if [get_compiler_info ${binfile}] {
49 +# This test can only be run on gcc as we use additional_flags=FIXME
50 +if {$gcc_compiled == 0} {
54 +if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
55 + untested "Couldn't compile test library"
59 +# The new separate debug info file will be stored in the .debug subdirectory.
61 +if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
62 + # check that you have a recent version of strip and objcopy installed
63 + unsupported "cannot produce separate debug info files"
67 +if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
68 + # Maybe we don't have prelink.
72 +if { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
73 + "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
79 +gdb_reinitialize_dir $srcdir/$subdir
84 +gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
87 +# #0 0x00110430 in __kernel_vsyscall ()
88 +# No symbol table info available.
89 +# #1 0x003d44c0 in raise () from /lib/libc.so.6
90 +# No symbol table info available.
91 +# #2 0x003d5e88 in abort () from /lib/libc.so.6
92 +# No symbol table info available.
93 +# #3 0x44f10437 in func () at dw2-loclist-prelinked.c:8
94 +# i = Could not find the frame base for "func".
97 +# #0 0x00110430 in __kernel_vsyscall ()
98 +# No symbol table info available.
99 +# #1 0x003d44c0 in raise () from /lib/libc.so.6
100 +# No symbol table info available.
101 +# #2 0x003d5e88 in abort () from /lib/libc.so.6
102 +# No symbol table info available.
103 +# #3 0x4ae36437 in func () at dw2-loclist-prelinked.c:8
105 +# #4 0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
108 +# `abort' can get expressed as `*__GI_abort'.
109 +gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
110 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
111 ===================================================================
112 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
113 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c 2009-09-09 20:10:35.000000000 +0200
115 +/* This testcase is part of GDB, the GNU debugger.
117 + Copyright 2008 Free Software Foundation, Inc.
119 + This program is free software; you can redistribute it and/or modify
120 + it under the terms of the GNU General Public License as published by
121 + the Free Software Foundation; either version 3 of the License, or
122 + (at your option) any later version.
124 + This program is distributed in the hope that it will be useful,
125 + but WITHOUT ANY WARRANTY; without even the implied warranty of
126 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
127 + GNU General Public License for more details.
129 + You should have received a copy of the GNU General Public License
130 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
132 +/* dw2-loclist-prelinked-func.S */
133 +extern void func (void);
141 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
142 ===================================================================
143 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
144 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S 2009-09-09 20:10:35.000000000 +0200
146 +/* This testcase is part of GDB, the GNU debugger.
148 + Copyright 2008 Free Software Foundation, Inc.
150 + This program is free software; you can redistribute it and/or modify
151 + it under the terms of the GNU General Public License as published by
152 + the Free Software Foundation; either version 3 of the License, or
153 + (at your option) any later version.
155 + This program is distributed in the hope that it will be useful,
156 + but WITHOUT ANY WARRANTY; without even the implied warranty of
157 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158 + GNU General Public License for more details.
160 + You should have received a copy of the GNU General Public License
161 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
174 + .file "dw2-loclist-prelinked.c"
175 + .section .debug_abbrev,"",@progbits
177 + .section .debug_info,"",@progbits
179 + .section .debug_line,"",@progbits
184 + .type func, @function
187 + .file 1 "dw2-loclist-prelinked.c"
199 + .section .debug_frame,"",@progbits
201 + .long .LECIE0-.LSCIE0
217 + .long .LEFDE0-.LASFDE0
229 + .long .LCFI1-.LCFI0
236 + .section .debug_loc,"",@progbits
239 + .long .LFB2-.Ltext0
240 + .long .LCFI0-.Ltext0
244 + .long .LCFI0-.Ltext0
245 + .long .LCFI1-.Ltext0
249 + .long .LCFI1-.Ltext0
250 + .long .LFE2-.Ltext0
256 + .section .debug_info
259 + .long .Ldebug_abbrev0
268 + .long .Ldebug_line0
335 + .section .debug_abbrev
423 + .section .debug_pubnames,"",@progbits
426 + .long .Ldebug_info0
431 + .section .debug_aranges,"",@progbits
434 + .long .Ldebug_info0
440 + .long .Letext0-.Ltext0
443 + .section .debug_str,"MS",@progbits,1
445 + .string "long long int"
447 + .string "unsigned int"
449 + .string "dw2-loclist-prelinked.c"
451 + .string "gdb-6.8/gdb/testsuite/gdb.dwarf2"
453 + .string "long unsigned int"
455 + .string "long long unsigned int"
457 + .string "unsigned char"
463 + .string "short unsigned int"
465 + .string "signed char"
467 + .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
471 + .string "short int"
472 + .ident "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
473 + .section .note.GNU-stack,"",@progbits