This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Regression on prelinked-sepdebug-shlibs
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tristan Gingold <gingold at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 25 Dec 2009 21:04:40 +0100
- Subject: Regression on prelinked-sepdebug-shlibs
Hi,
Re: [RFA] Make sym_read routines handle separate debug files
http://sourceware.org/ml/gdb-patches/2009-12/msg00117.html
http://sourceware.org/ml/gdb-cvs/2009-12/msg00042.html
ffb64a120e667bad7b2a79c5e617bdea7328f996
* symfile.h (symbol_file_add_separate): New prototype.
(find_separate_debug_file_by_buildid): Ditto.
(find_separate_debug_file_by_debuglink): Ditto.
* symfile.c (reread_separate_symbols): Remove.
(find_separate_debug_file): Split into ...
(find_separate_debug_file_by_buildid): ... this and ...
(find_separate_debug_file_by_debuglink): ... this.
(symbol_file_add_with_addrs_or_offsets): Do not save orig_addrs.
Remove separate debug file handling.
(symbol_file_add_separate): New function.
(reread_symbols): Do not considere separate debug files, but free
them while handling their parent. Reindent.
* coffread.c (coff_symfile_read): Handle separate object file.
* elfread.c (elf_symfile_read): Ditto.
has caused a regression:
echo 'void f (void) {}'|gcc -Wall -fPIC -shared -g -o a.so -x c -;objcopy --only-keep-debug a.so a.so.debug;objcopy --strip-debug --add-gnu-debuglink=a.so.debug a.so;prelink -NR a.so;echo 'extern void f (void);int main (void) { f (); return 0; }'|gcc -Wall -g -o a ./a.so -x c -;./gdb -nx -ex start -ex 'adv f' ./a
printing now:
Cannot access memory at address 0x52c
prelink will set in-file addresses to some random value while in the .debug
file they remain zero-based. In such case "section_offsets" below will remain
zero because the library will (probably) get loaded at the same address as the
file is prelinked at. Still the .debug file must be relocated in such case.
symbol_file_add_separate calls there now:
0, /* No addr table. */
while it supplies:
objfile->section_offsets, objfile->num_sections,
This cannot work as the binary file and its separate debug info file are two
different objfiles having different number and ordering of sections.
objfile-independent displacement format is that "addr table".
There was some description of these data structures in:
[patch 05/15] PIE: Move some symfile code into subroutines
http://sourceware.org/ml/gdb-patches/2009-11/msg00172.html
[patch 06/15] PIE: Fix displacement of separate debug info files
http://sourceware.org/ml/gdb-patches/2009-11/msg00173.html
(I see a big conflict now there for my unchecked-in PIE patch, oops.)
One should probably build temporary addr-table from objfile there.
I did not provide the testcase above as a GDB testcase as it is exactly one
case of the more general "break-interp.exp" test supporting shlibs by:
[patch 10/15] PIE: testcase: Test also shared libraries
http://sourceware.org/ml/gdb-patches/2009-11/msg00177.html
Regards,
Jan