From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15974 invoked by alias); 13 Feb 2010 22:34:59 -0000 Received: (qmail 15965 invoked by uid 22791); 13 Feb 2010 22:34:58 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,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; Sat, 13 Feb 2010 22:34:52 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1DMYSPt032098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 13 Feb 2010 17:34:28 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1DMYQUJ001522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 13 Feb 2010 17:34:28 -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 o1DMYQCe027381; Sat, 13 Feb 2010 23:34:26 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o1DMYPap027380; Sat, 13 Feb 2010 23:34:25 +0100 Date: Sat, 13 Feb 2010 22:34:00 -0000 From: Jan Kratochvil To: Tristan Gingold Cc: gdb-patches@sourceware.org Subject: [patch] build_section_addr_info* SEC_ALLOC/SEC_LOAD unification Message-ID: <20100213223425.GA27252@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: 2010-02/txt/msg00344.txt.bz2 Hi Tristan, http://sourceware.org/ml/gdb-patches/2010-01/msg00111.html http://sourceware.org/ml/gdb-cvs/2010-01/msg00051.html 3bfec189bb0fa1a2a44f1645dd68a9572e7a841c 2010-01-07 Tristan Gingold * symfile.c (build_section_addr_info_from_objfile): New function. (symbol_file_add_separate): Don't use offsets from objfile but built an addr info. this new function creates the address information for _all_ the sections while former build_section_addr_info_from_section_table creates it only if section is SEC_ALLOC or SEC_LOAD. While I have no countercase I do not see a reason for such difference, do you? My previous unchecked-in patch had implemented this function on top of build_section_addr_info_from_section_table and thus conforming to this SEC_ALLOC or SEC_LOAD conditional: [patch 06/15] PIE: Fix displacement of separate debug info files http://sourceware.org/ml/gdb-patches/2009-11/msg00173.html No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Thanks, Jan 2010-02-13 Jan Kratochvil * symfile.c (build_section_addr_info_from_objfile): Include sections only if they are SEC_ALLOC or SEC_LOAD. --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -371,16 +371,16 @@ build_section_addr_info_from_objfile (const struct objfile *objfile) mask = ((CORE_ADDR) 1 << addr_bit) - 1; sap = alloc_section_addr_info (objfile->num_sections); - for (i = 0, sec = objfile->obfd->sections; - i < objfile->num_sections; - i++, sec = sec->next) - { - gdb_assert (sec != NULL); - sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec) - + objfile->section_offsets->offsets[i]) & mask; - sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd, sec)); - sap->other[i].sectindex = sec->index; - } + for (i = 0, sec = objfile->obfd->sections; sec != NULL; sec = sec->next) + if (bfd_get_section_flags (objfile->obfd, sec) & (SEC_ALLOC | SEC_LOAD)) + { + sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec) + + objfile->section_offsets->offsets[i]) & mask; + sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd, + sec)); + sap->other[i].sectindex = sec->index; + i++; + } return sap; }