From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108210 invoked by alias); 10 Jul 2018 04:08:44 -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 108200 invoked by uid 89); 10 Jul 2018 04:08:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=buildsym X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 04:08:42 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 15EE11E08D; Tue, 10 Jul 2018 00:08:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1531195721; bh=IBSsf/EKytX0vr/foZlcj5mQdW+/4wXT679r8UkjUeo=; h=Subject:To:References:From:Date:In-Reply-To:From; b=LKymbhnkCqZPvcbutE3Vs4frsQRNff+yX5Aht//MY7+TjDG2ABBMIyvxM/hrBi1i3 wE9GMHd7BLhmH04tNVKGwtADRU+fMF3OURyuP86qkvaxKDDSa6r3uvhEZHE/cdXvpz PS27olwtFXOdSzw9uK93tP5rzo34dWqktxDM8cC8= Subject: Re: [RFA 34/42] Add many methods to buildsym_compunit To: Tom Tromey , gdb-patches@sourceware.org References: <20180523045851.11660-1-tom@tromey.com> <20180523045851.11660-35-tom@tromey.com> From: Simon Marchi Message-ID: Date: Tue, 10 Jul 2018 04:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180523045851.11660-35-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00251.txt.bz2 On 2018-05-23 12:58 AM, Tom Tromey wrote: > This adds many methods to buildsym_compunit and makes the data members > private. Essentially the entire buildsym API is now available as a > method on buildsym_compunit. However, standalone functions are still > provided, as this is what the sybmol readers actually use. > > gdb/ChangeLog > 2018-05-22 Tom Tromey > > * buildsym.c (buildsym_compunit::buildsym_compunit): Do more > initialization. > (buildsym_compunit): Add new constructor. > (struct buildsym_compunit) record_block_range, start_subfile, patch_subfile_names, > push_subfile, pop_subfile, record_line, get_compunit_symtab, > set_last_source_start_addr, get_last_source_start_addr, > get_local_using_directives, set_local_using_directives, > get_global_using_directives, outermost_context_p, > get_current_context_stack, get_context_stack_depth, > get_current_subfile, get_local_symbols, get_file_symbols, > get_global_symbols, record_debugformat, record_producer, > push_context, pop_context, end_symtab_get_static_block, > end_symtab_from_static_block, end_symtab, end_expandable_symtab>: > New public methods. > watch_main_source_file_lossage, end_symtab_with_blockvector>: New > private methods. > Update all users. > --- > gdb/ChangeLog | 22 +++ > gdb/buildsym.c | 610 +++++++++++++++++++++++++++++++++++++++------------------ > 2 files changed, 444 insertions(+), 188 deletions(-) > > diff --git a/gdb/buildsym.c b/gdb/buildsym.c > index c965776d82..b9be6dd61a 100644 > --- a/gdb/buildsym.c > +++ b/gdb/buildsym.c > @@ -103,6 +103,32 @@ struct buildsym_compunit > language (language_), > m_last_source_start_addr (last_addr) > { > + /* Allocate the compunit symtab now. The caller needs it to allocate > + non-primary symtabs. It is also needed by get_macro_table. */ > + compunit_symtab = allocate_compunit_symtab (objfile, name); > + > + /* Build the subfile for NAME (the main source file) so that we can record > + a pointer to it for later. > + IMPORTANT: Do not allocate a struct symtab for NAME here. > + It can happen that the debug info provides a different path to NAME than > + DIRNAME,NAME. We cope with this in watch_main_source_file_lossage but > + that only works if the main_subfile doesn't have a symtab yet. */ > + start_subfile (name); > + /* Save this so that we don't have to go looking for it at the end > + of the subfiles list. */ > + main_subfile = m_current_subfile; > + } > + > + buildsym_compunit (struct objfile *objfile_, const char *name, > + const char *comp_dir_, enum language language_, > + CORE_ADDR last_addr, struct compunit_symtab *cust) > + : objfile (objfile_), > + m_last_source_file (name == nullptr ? nullptr : xstrdup (name)), > + comp_dir (comp_dir_ == nullptr ? nullptr : xstrdup (comp_dir_)), > + compunit_symtab (cust), > + language (language_), > + m_last_source_start_addr (last_addr) > + { > } Oh, and could you provide a comment for the second constructor? Thanks, Simon