From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18482 invoked by alias); 25 Dec 2009 20:05:33 -0000 Received: (qmail 18472 invoked by uid 22791); 25 Dec 2009 20:05:33 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Dec 2009 20:05:28 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBPK4jHa026005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Dec 2009 15:04:45 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBPK4gJY014974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Dec 2009 15:04:44 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id nBPK4fgC006505; Fri, 25 Dec 2009 21:04:41 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id nBPK4eVU006502; Fri, 25 Dec 2009 21:04:40 +0100 Date: Fri, 25 Dec 2009 20:05:00 -0000 From: Jan Kratochvil To: Tristan Gingold Cc: gdb-patches@sourceware.org Subject: Regression on prelinked-sepdebug-shlibs Message-ID: <20091225200440.GA3747@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00395.txt.bz2 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