diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-09-25 16:10:50 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-10-02 14:05:51 +0100 |
commit | df07e2c772dab40d268dc44c78bb087c4b75b3c6 (patch) | |
tree | fde7a980951c491f5b4955c562a8690d3eeeaf29 /gdb | |
parent | 554ac434b02465f1fc925b0ae3393fb841e0d59c (diff) | |
download | binutils-df07e2c772dab40d268dc44c78bb087c4b75b3c6.zip binutils-df07e2c772dab40d268dc44c78bb087c4b75b3c6.tar.gz binutils-df07e2c772dab40d268dc44c78bb087c4b75b3c6.tar.bz2 |
gdb: Remove a use of VEC from dwarf2read.{c,h}
Removes a use of VEC from dwarf2read.{c,h} and replaces it with
std::vector. As far as possible this is a like for like replacement
with minimal refactoring.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* dwarf2read.c (struct type_unit_group) <tus>: Convert to
std::vector.
(build_type_psymtabs_reader): Update for std::vector.
(build_type_psymtab_dependencies): Likewise.
* dwarf2read.h: Remove use of DEF_VEC_P.
(typedef sig_type_ptr): Delete.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 17 | ||||
-rw-r--r-- | gdb/dwarf2read.h | 3 |
3 files changed, 18 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d18431..81e3724 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2019-10-02 Andrew Burgess <andrew.burgess@embecosm.com> + * dwarf2read.c (struct type_unit_group) <tus>: Convert to + std::vector. + (build_type_psymtabs_reader): Update for std::vector. + (build_type_psymtab_dependencies): Likewise. + * dwarf2read.h: Remove use of DEF_VEC_P. + (typedef sig_type_ptr): Delete. + +2019-10-02 Andrew Burgess <andrew.burgess@embecosm.com> + * btrace.c (btrace_maint_clear): Update to handle change from VEC to std::vector. (btrace_maint_decode_pt): Likewise, and move allocation of the diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 53e7393..30658b2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -620,7 +620,7 @@ struct type_unit_group /* The TUs that share this DW_AT_stmt_list entry. This is added to while parsing type units to build partial symtabs, and is deleted afterwards and not used again. */ - VEC (sig_type_ptr) *tus; + std::vector <signatured_type *> *tus; /* The compunit symtab. Type units in a group needn't all be defined in the same source file, @@ -8184,7 +8184,9 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader, attr = dwarf2_attr_no_follow (type_unit_die, DW_AT_stmt_list); tu_group = get_type_unit_group (cu, attr); - VEC_safe_push (sig_type_ptr, tu_group->tus, sig_type); + if (tu_group->tus == nullptr) + tu_group->tus = new std::vector <signatured_type *>; + tu_group->tus->push_back (sig_type); prepare_one_comp_unit (cu, type_unit_die, language_minimal); pst = create_partial_symtab (per_cu, ""); @@ -8341,8 +8343,7 @@ build_type_psymtab_dependencies (void **slot, void *info) struct type_unit_group *tu_group = (struct type_unit_group *) *slot; struct dwarf2_per_cu_data *per_cu = &tu_group->per_cu; struct partial_symtab *pst = per_cu->v.psymtab; - int len = VEC_length (sig_type_ptr, tu_group->tus); - struct signatured_type *iter; + int len = (tu_group->tus == nullptr) ? 0 : tu_group->tus->size (); int i; gdb_assert (len > 0); @@ -8350,16 +8351,16 @@ build_type_psymtab_dependencies (void **slot, void *info) pst->number_of_dependencies = len; pst->dependencies = objfile->partial_symtabs->allocate_dependencies (len); - for (i = 0; - VEC_iterate (sig_type_ptr, tu_group->tus, i, iter); - ++i) + for (i = 0; i < len; ++i) { + struct signatured_type *iter = tu_group->tus->at (i); gdb_assert (iter->per_cu.is_debug_types); pst->dependencies[i] = iter->per_cu.v.psymtab; iter->type_unit_group = tu_group; } - VEC_free (sig_type_ptr, tu_group->tus); + delete tu_group->tus; + tu_group->tus = nullptr; return 1; } diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h index d5a0299..aee8742 100644 --- a/gdb/dwarf2read.h +++ b/gdb/dwarf2read.h @@ -401,9 +401,6 @@ struct signatured_type struct dwo_unit *dwo_unit; }; -typedef struct signatured_type *sig_type_ptr; -DEF_VEC_P (sig_type_ptr); - ULONGEST read_unsigned_leb128 (bfd *, const gdb_byte *, unsigned int *); /* This represents a '.dwz' file. */ |