diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-03-30 17:18:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-03-30 17:18:55 -0400 |
commit | 17d08cd4137063dbc43d9989b9a5cb315171174f (patch) | |
tree | ecbbf6b61c0efd740b3d1242266d311dc5db46d2 /gdb/gdbserver | |
parent | a18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756 (diff) | |
download | gdb-17d08cd4137063dbc43d9989b9a5cb315171174f.zip gdb-17d08cd4137063dbc43d9989b9a5cb315171174f.tar.gz gdb-17d08cd4137063dbc43d9989b9a5cb315171174f.tar.bz2 |
Use std::vector and std::string instead of VEC(char_ptr) in gdbserver tdesc
This is a straightforward replacement, no change in behavior are
intended/expected.
gdb/gdbserver/ChangeLog:
* tdesc.h (struct target_desc) <features>: Change type to
std::vector<std::string>.
* tdesc.c (target_desc::~target_desc): Adjust to std::vector
changes.
(tdesc_get_features_xml): Likewise.
(tdesc_create_feature): Likewise.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/gdbserver/tdesc.c | 13 | ||||
-rw-r--r-- | gdb/gdbserver/tdesc.h | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 8e6afef..8e0f13a 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,12 @@ +2018-03-30 Simon Marchi <simon.marchi@polymtl.ca> + + * tdesc.h (struct target_desc) <features>: Change type to + std::vector<std::string>. + * tdesc.c (target_desc::~target_desc): Adjust to std::vector + changes. + (tdesc_get_features_xml): Likewise. + (tdesc_create_feature): Likewise. + 2018-03-26 Alan Hayward <alan.hayward@arm.com> * regcache.c (find_register_by_number): Return a ref. diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c index cec7a66..9f00ecf 100644 --- a/gdb/gdbserver/tdesc.c +++ b/gdb/gdbserver/tdesc.c @@ -27,12 +27,6 @@ target_desc::~target_desc () xfree ((char *) arch); xfree ((char *) osabi); - - char *f; - - for (i = 0; VEC_iterate (char_ptr, features, i, f); i++) - xfree (f); - VEC_free (char_ptr, features); } bool target_desc::operator== (const target_desc &other) const @@ -127,7 +121,7 @@ tdesc_get_features_xml (target_desc *tdesc) { /* Either .xmltarget or .features is not NULL. */ gdb_assert (tdesc->xmltarget != NULL - || (tdesc->features != NULL + || (!tdesc->features.empty () && tdesc->arch != NULL)); if (tdesc->xmltarget == NULL) @@ -147,9 +141,8 @@ tdesc_get_features_xml (target_desc *tdesc) buffer += "</osabi>"; } - char *xml; - for (int i = 0; VEC_iterate (char_ptr, tdesc->features, i, xml); i++) + for (const std::string &xml : tdesc->features) { buffer += "<xi:include href=\""; buffer += xml; @@ -175,7 +168,7 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name, const char *xml) { #ifndef IN_PROCESS_AGENT - VEC_safe_push (char_ptr, tdesc->features, xstrdup (xml)); + tdesc->features.emplace_back (xml); #endif return tdesc; } diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h index a625443..85139d9 100644 --- a/gdb/gdbserver/tdesc.h +++ b/gdb/gdbserver/tdesc.h @@ -54,7 +54,7 @@ struct target_desc : tdesc_feature const char *xmltarget = NULL; /* XML features in this target description. */ - VEC (char_ptr) *features = NULL; + std::vector<std::string> features; /* The value of <architecture> element in the XML, replying GDB. */ const char *arch = NULL; |