From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 981 invoked by alias); 17 Aug 2009 19:28:01 -0000 Received: (qmail 967 invoked by uid 22791); 17 Aug 2009 19:28:01 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_31,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate5.de.ibm.com (HELO mtagate5.de.ibm.com) (195.212.29.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Aug 2009 19:27:48 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.14.3/8.13.8) with ESMTP id n7HJRZ0D374850 for ; Mon, 17 Aug 2009 19:27:35 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7HJRZTC2650198 for ; Mon, 17 Aug 2009 21:27:35 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7HJRZ2G029216 for ; Mon, 17 Aug 2009 21:27:35 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n7HJRYPE029205; Mon, 17 Aug 2009 21:27:34 +0200 Message-Id: <200908171927.n7HJRYPE029205@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 17 Aug 2009 21:27:34 +0200 Subject: Re: [patch] Speed up find_pc_section To: ppluzhnikov@google.com (Paul Pluzhnikov) Date: Mon, 17 Aug 2009 19:45:00 -0000 From: "Ulrich Weigand" Cc: tromey@redhat.com (Tom Tromey), gdb-patches@sourceware.org (gdb-patches ml) In-Reply-To: <8ac60eac0908081108nd118424l7a1c88b87130bb78@mail.gmail.com> from "Paul Pluzhnikov" at Aug 08, 2009 11:08:38 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-08/txt/msg00254.txt.bz2 Paul Pluzhnikov wrote: > 2009-08-08 Paul Pluzhnikov > > * objfiles.c (qsort_cmp): Remove assert. > (preferred_obj_section): New function. > (update_section_map): Filter duplicates. This patch breaks overlay support: +static struct obj_section * +preferred_obj_section (struct obj_section *a, struct obj_section *b) +{ + gdb_assert (obj_section_addr (a) == obj_section_addr (b)); + gdb_assert ((a->objfile->separate_debug_objfile == b->objfile) + || (b->objfile->separate_debug_objfile == a->objfile)); + gdb_assert ((a->objfile->separate_debug_objfile_backlink == b->objfile) + || (b->objfile->separate_debug_objfile_backlink == a->objfile)); + + if (a->objfile->separate_debug_objfile != NULL) + return a; + return b; +} + /* With separate debuginfo files, we may have up to two (almost) + identical copies of some obj_sections in the map. + Filter out duplicates. */ + for (i = 0, j = 0; i < map_size; ++i) + { + struct obj_section *sect1 = map[i]; + struct obj_section *sect2 = (i + 1 < map_size) ? map[i + 1] : NULL; + + if (sect2 == NULL + || obj_section_addr (sect1) != obj_section_addr (sect2)) + map[j++] = sect1; + else + { + map[j++] = preferred_obj_section (sect1, sect2); + ++i; + } + } The patch appears to assume that two sections with the same start address must be from a separate debuginfo file. Of course, in the presence of overlays, you may have multiple regular sections with the same start address -- that's the point of overlays :-) These now always run into the assert above. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com