From patchwork Sat Apr 8 20:12:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 19916 Received: (qmail 23543 invoked by alias); 8 Apr 2017 20:13:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23492 invoked by uid 89); 8 Apr 2017 20:13:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 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: gproxy5.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Apr 2017 20:13:15 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy5.mail.unifiedlayer.com (Postfix) with ESMTP id 2E8A2140983 for ; Sat, 8 Apr 2017 14:12:19 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id 5wCG1v0072f2jeq01wCKdu; Sat, 08 Apr 2017 14:12:19 -0600 X-Authority-Analysis: v=2.2 cv=VKStp5HX c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=GyvpbNCt6jPKKuIX-ekA:9 a=4NjzbQcEItGoSRxq:21 a=T1DudprNVGFD5GvB:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-65-226.hlrn.qwest.net ([75.166.65.226]:43578 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cwwiV-0003Fw-Ts; Sat, 08 Apr 2017 14:12:16 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 12/14] Use std::vector in reread_symbols Date: Sat, 8 Apr 2017 14:12:06 -0600 Message-Id: <20170408201208.2672-13-tom@tromey.com> In-Reply-To: <20170408201208.2672-1-tom@tromey.com> References: <20170408201208.2672-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1cwwiV-0003Fw-Ts X-Source-Sender: 75-166-65-226.hlrn.qwest.net (bapiya.Home) [75.166.65.226]:43578 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This changes reread_symbols to use std::vector, removing a cleanup. 2017-04-07 Tom Tromey * symfile.c (objfilep): Remove typedef. (reread_symbols): Use a std::vector. --- gdb/ChangeLog | 5 +++++ gdb/symfile.c | 21 +++++---------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4a56a1e..0a481c2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-04-07 Tom Tromey + * symfile.c (objfilep): Remove typedef. + (reread_symbols): Use a std::vector. + +2017-04-07 Tom Tromey + * mi/mi-main.c (exec_direction_forward): Remove. (exec_reverse_continue, mi_execute_command): Use scoped_restore. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Use diff --git a/gdb/symfile.c b/gdb/symfile.c index 4d9fe54..0ef0029 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2434,10 +2434,6 @@ remove_symbol_file_command (char *args, int from_tty) do_cleanups (my_cleanups); } -typedef struct objfile *objfilep; - -DEF_VEC_P (objfilep); - /* Re-read symbols if a symbol-file has changed. */ void @@ -2447,10 +2443,7 @@ reread_symbols (void) long new_modtime; struct stat new_statbuf; int res; - VEC (objfilep) *new_objfiles = NULL; - struct cleanup *all_cleanups; - - all_cleanups = make_cleanup (VEC_cleanup (objfilep), &new_objfiles); + std::vector new_objfiles; /* With the addition of shared libraries, this should be modified, the load time should be saved in the partial symbol tables, since @@ -2661,14 +2654,12 @@ reread_symbols (void) objfile->mtime = new_modtime; init_entry_point_info (objfile); - VEC_safe_push (objfilep, new_objfiles, objfile); + new_objfiles.push_back (objfile); } } - if (new_objfiles) + if (!new_objfiles.empty ()) { - int ix; - /* Notify objfiles that we've modified objfile sections. */ objfiles_changed (); @@ -2677,15 +2668,13 @@ reread_symbols (void) /* clear_objfile_data for each objfile was called before freeing it and observer_notify_new_objfile (NULL) has been called by clear_symtab_users above. Notify the new files now. */ - for (ix = 0; VEC_iterate (objfilep, new_objfiles, ix, objfile); ix++) - observer_notify_new_objfile (objfile); + for (auto iter : new_objfiles) + observer_notify_new_objfile (iter); /* At least one objfile has changed, so we can consider that the executable we're debugging has changed too. */ observer_notify_executable_changed (); } - - do_cleanups (all_cleanups); }