From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15496 invoked by alias); 6 Jan 2014 17:39:23 -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 15487 invoked by uid 89); 6 Jan 2014 17:39:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vb0-f45.google.com Received: from mail-vb0-f45.google.com (HELO mail-vb0-f45.google.com) (209.85.212.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 06 Jan 2014 17:39:21 +0000 Received: by mail-vb0-f45.google.com with SMTP id i12so9157697vbh.18 for ; Mon, 06 Jan 2014 09:39:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+byQcDujlJbBkf+lGuHtXmxZKs/W4BB56OMJAivkPLM=; b=DrDJc05xIOGTe9HbtSatIOsfSXb4CmxMqnOfIBXYiy+iB/PiTwG9lI5cmydIITX4Sq FUD58o52CosfQUWdm//w65H1IrIo7VkwtAg1k68KLUo34jGCqkWOyd1u4D+VF6OrSDXR pIr2aw98frpdHepwSZHF4uduvXNdqMQEabxIPRVD1bM2UDpjcRI9StNWpFL5iGA1BxzW fGV9uQ/wvcksN9dXTjl2HBsgStYhNh4pCYLy0zjqJp4aoksMDDXldtFNdfjjUI3NxrzP TSrckw4cnfLX0yYBHtxswHuch9VC113ZZ0QUwWKg44TR6cs/MRq/mTkSaxBW216K1Gcw UNxw== X-Gm-Message-State: ALoCoQmopmbJHRSE6vT+up6FrCYfevhPT1IE2v+8xmpozxPE8sdnir/yBKL6BgJ6CiBP7uvft7bu5x1gSkmrFBUvGj9i8OlwGBn1GVQqzzq6O59rz+8SMCu8/70c4v7ULFww0J9bbmGaLGeObCSJXJl+WSKGJkl6blmV2XI4VmE2y93q1bFDHQSrh1KQPqAsvknpYUsPrwtraIPEx4C1dZ2xqW1MNd/5GA== MIME-Version: 1.0 X-Received: by 10.52.120.11 with SMTP id ky11mr4102665vdb.28.1389029959280; Mon, 06 Jan 2014 09:39:19 -0800 (PST) Received: by 10.52.248.65 with HTTP; Mon, 6 Jan 2014 09:39:19 -0800 (PST) In-Reply-To: <1389028297-16977-4-git-send-email-tromey@redhat.com> References: <1389028297-16977-1-git-send-email-tromey@redhat.com> <1389028297-16977-4-git-send-email-tromey@redhat.com> Date: Mon, 06 Jan 2014 17:39:00 -0000 Message-ID: Subject: Re: [PATCH 3/3] move the "main" data into the per-BFD object From: Doug Evans To: Tom Tromey Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00075.txt.bz2 On Mon, Jan 6, 2014 at 9:11 AM, Tom Tromey wrote: > This adds the "main"-related data into the per-BFD. This is needed > because once symbol sharing across objfiles is complete, computing the > main name as a side effect of symbol reading will no longer work -- > the symbols simply won't be re-read. > > After this change, set_main_name is only used by the main_name > machinery itself, so this patch makes it static. > > 2014-01-06 Tom Tromey > > * dbxread.c (process_one_symbol): Use set_objfile_main_name. > * dwarf2read.c (read_partial_die): Use set_objfile_main_name. > * objfiles.c (get_objfile_bfd_data): Initialize language_of_main. > (set_objfile_main_name): New function. > * objfiles.h (struct objfile_per_bfd_storage) language_of_main>: New fields. > (set_objfile_main_name): Declare. > * symtab.c (find_main_name): Loop over objfiles to find the main > name and language. > (set_main_name): Now static. > * symtab.h (set_main_name): Don't declare. > [...] > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -5057,7 +5057,7 @@ main_info_cleanup (struct program_space *pspace, void *data) > xfree (info); > } > > -void > +static void > set_main_name (const char *name, enum language lang) > { > struct main_info *info = get_main_info (); > @@ -5082,6 +5082,17 @@ static void > find_main_name (void) > { > const char *new_main_name; > + struct objfile *objfile; > + > + ALL_OBJFILES (objfile) > + { > + if (objfile->per_bfd->name_of_main != NULL) > + { > + set_main_name (objfile->per_bfd->name_of_main, > + objfile->per_bfd->language_of_main); > + return; > + } > + } > > /* Try to see if the main procedure is in Ada. */ > /* FIXME: brobecker/2005-03-07: Another way of doing this would Hi. [setting aside a day when there are multiple main names,] Seems like there ought to be an invariant that there is only one main name. I ask because it's not clear this invariant is enforced (or if it is it's too subtle) and thus what if this loop finds the wrong one?