From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29078 invoked by alias); 4 Jan 2010 15:22:44 -0000 Received: (qmail 29066 invoked by uid 22791); 4 Jan 2010 15:22:43 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jan 2010 15:22:38 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id DBF56290007; Mon, 4 Jan 2010 16:22:35 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9oq8lq9OTmta; Mon, 4 Jan 2010 16:22:35 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 493D3290004; Mon, 4 Jan 2010 16:22:35 +0100 (CET) Subject: Re: Regression on prelinked-sepdebug-shlibs Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Tristan Gingold In-Reply-To: <20091225200440.GA3747@host0.dyn.jankratochvil.net> Date: Mon, 04 Jan 2010 15:22:00 -0000 Cc: gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <1EA52AF6-6633-4D00-A3D7-842856D6C908@adacore.com> References: <20091225200440.GA3747@host0.dyn.jankratochvil.net> To: Jan Kratochvil 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-01/txt/msg00061.txt.bz2 Jan, can you try and/or comment this patch before I officially submit it ? No s= epdebug.exp regressions. Tristan. 2010-01-04 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. diff --git a/gdb/symfile.c b/gdb/symfile.c index 11bc2af..d6ecf0d 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -384,6 +384,38 @@ build_section_addr_info_from_section_table (const stru= ct target_section *start, return sap; } =20 +/* Create a section_addr_info from section offsets in OBJFILE. Return NULL + if all offsets are 0. */ + +static struct section_addr_info * +build_section_addr_info_from_objfile (const struct objfile *objfile) +{ + struct section_addr_info *sap; + int i; + struct bfd_section *sec; + + /* In most cases, the offsets are 0. In this case we return NULL to red= uce + overhead. */ + for (i =3D 0; i < objfile->num_sections; i++) + if (objfile->section_offsets->offsets[i]) + break; + if (i >=3D objfile->num_sections) + return NULL; + + sap =3D alloc_section_addr_info (objfile->num_sections); + for (i =3D 0, sec =3D objfile->obfd->sections; + i < objfile->num_sections; + i++, sec =3D sec->next) + { + gdb_assert (sec !=3D NULL); + sap->other[i].addr =3D bfd_get_section_vma (objfile->obfd, sec) + + objfile->section_offsets->offsets[i]; + sap->other[i].name =3D xstrdup (bfd_get_section_name (objfile->obfd,= sec)); + sap->other[i].sectindex =3D sec->index; + } + return sap; +} + =20 /* Free all memory allocated by build_section_addr_info_from_section_table= . */ =20 @@ -1042,16 +1074,26 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, void symbol_file_add_separate (bfd *bfd, int symfile_flags, struct objfile *obj= file) { + struct section_addr_info *sap; + struct cleanup *my_cleanup; + /* Currently only one separate debug objfile is supported. */ gdb_assert (objfile && objfile->separate_debug_objfile =3D=3D NULL); =20 + sap =3D build_section_addr_info_from_objfile (objfile); + if (sap) + my_cleanup =3D make_cleanup_free_section_addr_info (sap); + objfile->separate_debug_objfile =3D symbol_file_add_with_addrs_or_offsets (bfd, symfile_flags, - 0, /* No addr table. */ - objfile->section_offsets, objfile->num_sections, + sap, NULL, 0, objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW | OBJF_USERLOADED)); + + if (sap) + do_cleanups (my_cleanup); + objfile->separate_debug_objfile->separate_debug_objfile_backlink =3D objfile;