From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA] Change program_space::added_solibs to a std::vector
Date: Tue, 29 May 2018 15:16:00 -0000 [thread overview]
Message-ID: <20180529151104.6387-1-tom@tromey.com> (raw)
This changes program_space::added_solibs to a std::vector, removing a
VEC.
Tested by the buildbot.
ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* progspace.h (so_list_ptr): Remove typedef. Don't declare VEC.
(struct program_space) <added_solibs>: 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<struct so_list *> 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
{
--
2.13.6
next reply other threads:[~2018-05-29 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 15:16 Tom Tromey [this message]
2018-05-29 16:14 ` Simon Marchi
2018-05-29 19:50 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180529151104.6387-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).