From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27075 invoked by alias); 4 May 2013 06:21:03 -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 27066 invoked by uid 89); 4 May 2013 06:21:02 -0000 X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS,TW_BJ autolearn=ham version=3.3.1 Received: from mail-vc0-f175.google.com (HELO mail-vc0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 04 May 2013 06:21:01 +0000 Received: by mail-vc0-f175.google.com with SMTP id lf10so1968540vcb.6 for ; Fri, 03 May 2013 23:21:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=WDs05jJ7pvXw9tEcS73u109HMGDuRu5/eZO6qsiXs74=; b=MNsYKkWJ4A5Yfps1zKUEfOnh+ZxXhHU05Ro1SnWLS/NhICXl+AT9ve5/3k/RQ9YPHV Aodo78wl9ICSYthyjPptSnBUN6/EZWbClEx7v6SwUTcXcT7i43EFzVUIr5WiCTwjVXms of9ZD+9DKZ5OeIP8+SU8lPh2z1biM/gGrB+C8w2PyM5PYrdpxg3EFwF6CLQGETFNkuSZ sbWfqqtDgn/nMRFR4QvUjHepN+00kovublXRa4SmdbcnsQTLK7vILxtrs7d6MW2EniZU +DfOoh0TvvGq3WzAG50vh5/BzVhOqrR6/+dURdOlySd4uP3Qo2SKUQcym6+HGeihyhHz BA1A== MIME-Version: 1.0 X-Received: by 10.52.94.227 with SMTP id df3mr3892220vdb.48.1367648460042; Fri, 03 May 2013 23:21:00 -0700 (PDT) Received: by 10.220.173.7 with HTTP; Fri, 3 May 2013 23:20:59 -0700 (PDT) In-Reply-To: <87bo9180ru.fsf@fleche.redhat.com> References: <87bo9180ru.fsf@fleche.redhat.com> Date: Sat, 04 May 2013 06:21:00 -0000 Message-ID: Subject: Re: [RFC] gdb_bfd_count_sections snafu From: Doug Evans To: Tom Tromey Cc: gdb-patches Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkPjFJ3xUnnOb+X97dpwmdc2hKOwb8el3CeuC9nV6gefH9WMhZGK63UmMgIr3OXk0zytOhZ4f69yHCVHSA3kCyFed7WzOWqVI5uEsZLdRvLWm+gLme2rzFwH6I2zOOY2t02xmh9wYk157wlB28fIAzsIbeoju3hMTxM3KHdwL87lVKDKfm9XIVUqWW4b6EqDwomgwabuBan05rixiDAdt7Jb1ifIA== X-SW-Source: 2013-05/txt/msg00073.txt.bz2 On Fri, Apr 26, 2013 at 2:01 PM, Tom Tromey wrote: >>>>>> "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 I committed the patch.