From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28560 invoked by alias); 8 Sep 2010 18:58:49 -0000 Received: (qmail 28552 invoked by uid 22791); 8 Sep 2010 18:58:48 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD 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; Wed, 08 Sep 2010 18:58:43 +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 o88IweCa004473 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 8 Sep 2010 14:58:42 -0400 Received: from host1.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 o88IwcQb023887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 8 Sep 2010 14:58:40 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o88Iwc6L024982 for ; Wed, 8 Sep 2010 20:58:38 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o88IwbJ2024981 for gdb-patches@sourceware.org; Wed, 8 Sep 2010 20:58:37 +0200 Date: Wed, 08 Sep 2010 19:40:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] .gdb_index: Do not crash on NOBITS Message-ID: <20100908185837.GA24606@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) 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: 2010-09/txt/msg00186.txt.bz2 Hi, elfutils-0.148 still do not contain patch of its GIT 804e9ca4d644e64a6125307cbf0a0b89477d7611 where the .gdb_index section has been also split into the separate debug info file. Due to it binaries split using elfutils-0.148 contain [38] .gdb_index NOBITS 0000000000000000 0000338c instead of expected [28] .gdb_index PROGBITS 0000000000000000 0000211c and due to it GDB while reading the file can error() by: Reading symbols from x.debug...Dwarf Error: Can't read DWARF data from 'x.debug' which should not be fatal but due to some other bugs therein it can crash GDB. The wrong separate debug info file is for example: http://kojipkgs.fedoraproject.org/packages/glibc/2.12.90/10/x86_64/glibc-debuginfo-2.12.90-10.x86_64.rpm /usr/lib/debug/lib64/libutil-2.12.90.so.debug OK to check-in? It does not attempt to use .gdb_index from the main binary, it will just disable .gdb_index usage on these binaries. Thanks, Jan gdb/ 2010-09-08 Jan Kratochvil * dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS. --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1904,6 +1904,13 @@ dwarf2_read_index (struct objfile *objfile) if (dwarf2_per_objfile->gdb_index.asection == NULL || dwarf2_per_objfile->gdb_index.size == 0) return 0; + + /* Older elfutils strip versions could keep the section in the main + executable while splitting it for the separate debug info file. */ + if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection) + & SEC_HAS_CONTENTS) == 0) + return 0; + dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index); addr = dwarf2_per_objfile->gdb_index.buffer;