From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111913 invoked by alias); 11 Apr 2017 15:01:42 -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 96257 invoked by uid 89); 11 Apr 2017 15:01:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy9.mail.unifiedlayer.com Received: from gproxy9-pub.mail.unifiedlayer.com (HELO gproxy9.mail.unifiedlayer.com) (69.89.20.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Apr 2017 15:01:24 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id E432F1E09F7 for ; Tue, 11 Apr 2017 09:01:23 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id 731L1v00J2f2jeq0131Piy; Tue, 11 Apr 2017 09:01:23 -0600 X-Authority-Analysis: v=2.2 cv=cpDrqxwi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=fumyOrh7jvKSBzaH_EwA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-65-226.hlrn.qwest.net ([75.166.65.226]:50042 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cxxIG-0007Ml-0G; Tue, 11 Apr 2017 09:01:20 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 05/17] Change increment_reading_symtab to return a scoped_restore Date: Tue, 11 Apr 2017 15:01:00 -0000 Message-Id: <20170411150112.23207-6-tom@tromey.com> In-Reply-To: <20170411150112.23207-1-tom@tromey.com> References: <20170411150112.23207-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1cxxIG-0007Ml-0G X-Source-Sender: 75-166-65-226.hlrn.qwest.net (bapiya.Home) [75.166.65.226]:50042 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-04/txt/msg00274.txt.bz2 This changes increment_reading_symtab to return a scoped_restore, then fixes up the users. gdb/ChangeLog 2017-04-11 Tom Tromey * symfile.h (increment_reading_symtab): Update type. * symfile.c (decrement_reading_symtab): Remove. (increment_reading_symtab): Return a scoped_restore_tmpl. * psymtab.c (psymtab_to_symtab): Update. * dwarf2read.c (dw2_instantiate_symtab): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2read.c | 2 +- gdb/psymtab.c | 3 +-- gdb/symfile.c | 15 +++------------ gdb/symfile.h | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a888174..1c76edb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2017-04-11 Tom Tromey + * symfile.h (increment_reading_symtab): Update type. + * symfile.c (decrement_reading_symtab): Remove. + (increment_reading_symtab): Return a scoped_restore_tmpl. + * psymtab.c (psymtab_to_symtab): Update. + * dwarf2read.c (dw2_instantiate_symtab): Update. + +2017-04-11 Tom Tromey + * jit.c (struct jit_reader): Declare separately. Add constructor and destructor. Change type of "handle". (loaded_jit_reader): Define separately. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 966e1ee..091d665 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2885,7 +2885,7 @@ dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu) if (!per_cu->v.quick->compunit_symtab) { struct cleanup *back_to = make_cleanup (free_cached_comp_units, NULL); - increment_reading_symtab (); + scoped_restore decrementer = increment_reading_symtab (); dw2_do_instantiate_symtab (per_cu); process_cu_includes (); do_cleanups (back_to); diff --git a/gdb/psymtab.c b/gdb/psymtab.c index bdce8f2..bb482ee 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -770,10 +770,9 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) /* If it has not yet been read in, read it. */ if (!pst->readin) { - struct cleanup *back_to = increment_reading_symtab (); + scoped_restore decrementer = increment_reading_symtab (); (*pst->read_symtab) (pst, objfile); - do_cleanups (back_to); } return pst->compunit_symtab; diff --git a/gdb/symfile.c b/gdb/symfile.c index 750039d..4d9fe54 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -91,8 +91,6 @@ static void add_symbol_file_command (char *, int); static const struct sym_fns *find_sym_fns (bfd *); -static void decrement_reading_symtab (void *); - static void overlay_invalidate_all (void); static void overlay_auto_command (char *, int); @@ -193,22 +191,15 @@ print_symbol_loading_p (int from_tty, int exec, int full) int currently_reading_symtab = 0; -static void -decrement_reading_symtab (void *dummy) -{ - currently_reading_symtab--; - gdb_assert (currently_reading_symtab >= 0); -} - /* Increment currently_reading_symtab and return a cleanup that can be used to decrement it. */ -struct cleanup * +scoped_restore_tmpl increment_reading_symtab (void) { - ++currently_reading_symtab; + return make_scoped_restore (¤tly_reading_symtab, + currently_reading_symtab + 1); gdb_assert (currently_reading_symtab > 0); - return make_cleanup (decrement_reading_symtab, NULL); } /* Remember the lowest-addressed loadable section we've seen. diff --git a/gdb/symfile.h b/gdb/symfile.h index 6066481..ab536e8 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -556,7 +556,7 @@ extern int symfile_map_offsets_to_segments (bfd *, struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); void free_symfile_segment_data (struct symfile_segment_data *data); -extern struct cleanup *increment_reading_symtab (void); +extern scoped_restore_tmpl increment_reading_symtab (void); void expand_symtabs_matching (gdb::function_view file_matcher, -- 2.9.3