From patchwork Tue May 29 15:11:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27539 Received: (qmail 67422 invoked by alias); 29 May 2018 15:11:11 -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 67353 invoked by uid 89); 29 May 2018 15:11:09 -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_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.133) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 May 2018 15:11:07 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 750AE400CA446 for ; Tue, 29 May 2018 10:11:06 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id NgHCfOznJRPojNgHCf6B4S; Tue, 29 May 2018 10:11:06 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:59336 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fNgHC-0009eI-60; Tue, 29 May 2018 10:11:06 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Change program_space::added_solibs to a std::vector Date: Tue, 29 May 2018 09:11:04 -0600 Message-Id: <20180529151104.6387-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fNgHC-0009eI-60 X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:59336 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This changes program_space::added_solibs to a std::vector, removing a VEC. Tested by the buildbot. ChangeLog 2018-05-29 Tom Tromey * progspace.h (so_list_ptr): Remove typedef. Don't declare VEC. (struct program_space) : Now a std::vector. * breakpoint.c (print_solib_event): Update. (check_status_catch_solib): Update. * progspace.c (clear_program_space_solib_cache): Update. * solib.c (update_solib_list): Update. --- gdb/ChangeLog | 9 +++++++++ gdb/breakpoint.c | 22 ++++++---------------- gdb/progspace.c | 3 +-- gdb/progspace.h | 5 +---- gdb/solib.c | 2 +- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 721afd2c049..291442a6b55 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4580,8 +4580,7 @@ static void print_solib_event (int is_catchpoint) { bool any_deleted = !current_program_space->deleted_solibs.empty (); - int any_added - = !VEC_empty (so_list_ptr, current_program_space->added_solibs); + int any_added = !current_program_space->added_solibs.empty (); if (!is_catchpoint) { @@ -4613,18 +4612,14 @@ print_solib_event (int is_catchpoint) if (any_added) { - struct so_list *iter; - int ix; - current_uiout->text (_(" Inferior loaded ")); ui_out_emit_list list_emitter (current_uiout, "added"); - for (ix = 0; - VEC_iterate (so_list_ptr, current_program_space->added_solibs, - ix, iter); - ++ix) + bool first = true; + for (struct so_list *iter : current_program_space->added_solibs) { - if (ix > 0) + if (!first) current_uiout->text (" "); + first = false; current_uiout->field_string ("library", iter->so_name); current_uiout->text ("\n"); } @@ -8009,12 +8004,7 @@ check_status_catch_solib (struct bpstats *bs) if (self->is_load) { - struct so_list *iter; - - for (int ix = 0; - VEC_iterate (so_list_ptr, current_program_space->added_solibs, - ix, iter); - ++ix) + for (struct so_list *iter : current_program_space->added_solibs) { if (!self->regex || self->compiled->exec (iter->so_name, 0, NULL, 0) == 0) diff --git a/gdb/progspace.c b/gdb/progspace.c index ba400d47aa5..9954a190d33 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -400,8 +400,7 @@ update_address_spaces (void) void clear_program_space_solib_cache (struct program_space *pspace) { - VEC_free (so_list_ptr, pspace->added_solibs); - + pspace->added_solibs.clear (); pspace->deleted_solibs.clear (); } diff --git a/gdb/progspace.h b/gdb/progspace.h index 456911b29b1..c2cc87dfced 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -36,9 +36,6 @@ struct address_space; struct program_space_data; struct address_space_data; -typedef struct so_list *so_list_ptr; -DEF_VEC_P (so_list_ptr); - /* A program space represents a symbolic view of an address space. Roughly speaking, it holds all the data associated with a non-running-yet program (main executable, main symbols), and when @@ -207,7 +204,7 @@ struct program_space /* When an solib is added, it is also added to this vector. This is so we can properly report solib changes to the user. */ - VEC (so_list_ptr) *added_solibs = NULL; + std::vector added_solibs; /* When an solib is removed, its name is added to this vector. This is so we can properly report solib changes to the user. */ diff --git a/gdb/solib.c b/gdb/solib.c index b28ebc628cb..8f3a12cddb2 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -862,7 +862,7 @@ update_solib_list (int from_tty) { i->pspace = current_program_space; - VEC_safe_push (so_list_ptr, current_program_space->added_solibs, i); + current_program_space->added_solibs.push_back (i); TRY {