From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13587 invoked by alias); 26 Apr 2013 21:01:19 -0000 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 Received: (qmail 13577 invoked by uid 89); 26 Apr 2013 21:01:19 -0000 X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_BJ autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Apr 2013 21:01:13 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3QL1BVf026434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Apr 2013 17:01:11 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3QL19tk020285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 26 Apr 2013 17:01:10 -0400 From: Tom Tromey To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFC] gdb_bfd_count_sections snafu References: Date: Sat, 27 Apr 2013 18:55:00 -0000 In-Reply-To: (Doug Evans's message of "Wed, 17 Apr 2013 01:10:09 -0700") Message-ID: <87bo9180ru.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-04/txt/msg00836.txt.bz2 >>>>> "Doug" == Doug Evans writes: Doug> HOWEVER, objfile->num_sections is computed with bfd_count_sections Doug> not gdb_bfd_count_sections. Thanks for finding this. Doug> This patch does clean up one thing: AFAICT when syms_from_objfile_1 Doug> is passed NULL for both addrs and offsets, there's no point in Doug> building local_addr to have more than one entry (zero would be fine Doug> too I think but space needs to be allocated for at least one entry). Doug> if (! addrs && ! offsets) Doug> { Doug> - local_addr Doug> - = alloc_section_addr_info (bfd_count_sections (objfile->obfd)); Doug> + local_addr = alloc_section_addr_info (1); Doug> make_cleanup (xfree, local_addr); Doug> addrs = local_addr; Doug> } Yeah, I believe we agreed in the original series that at least 1 was required. Otherwise it makes alloc_section_addr_info "weird"; and the downside of the current approach is just allocating a slightly larger object in some situations. Doug> Index: solib-target.c Doug> =================================================================== Doug> RCS file: /cvs/src/src/gdb/solib-target.c,v Doug> retrieving revision 1.28 Doug> diff -u -p -r1.28 solib-target.c Doug> --- solib-target.c 8 Apr 2013 20:04:42 -0000 1.28 Doug> +++ solib-target.c 17 Apr 2013 07:07:07 -0000 Doug> @@ -339,7 +339,7 @@ solib_target_relocate_section_addresses Doug> it any earlier, since we need to open the file first. */ Doug> if (so->lm_info->offsets == NULL) Doug> { Doug> - int num_sections = bfd_count_sections (so->abfd); Doug> + int num_sections = gdb_bfd_count_sections (so->abfd); I'm not certain that this one is needed. It seems harmless though. The rest looks good. I'm going to be off most of next week but I will try to remember to look into this again when I return. Tom