From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simark@simark.ca>, Tom Tromey <tom@tromey.com>,
markus.t.metzger@intel.com,
Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCHv4 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h}
Date: Thu, 26 Sep 2019 11:41:00 -0000 [thread overview]
Message-ID: <0fd630a9283d9990aa0cd13f5fcbbc8f377a90fb.1569497661.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1569497661.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1569497661.git.andrew.burgess@embecosm.com>
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.
---
gdb/ChangeLog | 9 +++++++++
gdb/dwarf2read.c | 17 +++++++++--------
gdb/dwarf2read.h | 3 ---
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1052501c351..e2aa1a1f903 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 d5a02990d41..aee8742a79c 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. */
--
2.14.5
next prev parent reply other threads:[~2019-09-26 11:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 15:54 [PATCHv2 0/3] Remove some uses of VEC Andrew Burgess
2019-09-23 22:09 ` [PATCH 0/2] Remove 2 uses of VEC from gdb Andrew Burgess
2019-09-23 22:09 ` [PATCH 1/2] gdb: Remove a VEC from gdbsupport/btrace-common.h Andrew Burgess
2019-09-24 2:09 ` Simon Marchi
2019-09-23 22:09 ` [PATCH 2/2] gdb: Change a VEC to std::vector in btrace.{c,h} Andrew Burgess
2019-09-24 2:19 ` Simon Marchi
2019-09-24 19:54 ` [PATCH 0/2] Remove 2 uses of VEC from gdb Tom Tromey
2019-09-25 15:54 ` [PATCHv2 1/3] gdb: Remove a VEC from gdbsupport/btrace-common.h Andrew Burgess
2019-09-25 15:54 ` [PATCHv2 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Andrew Burgess
2019-09-25 22:08 ` Tom Tromey
2019-09-26 0:00 ` [PATCHv3 1/3] gdb: Remove a VEC from gdbsupport/btrace-common.h Andrew Burgess
2019-09-26 8:47 ` Metzger, Markus T
2019-09-26 11:32 ` Andrew Burgess
2019-09-26 13:07 ` Metzger, Markus T
2019-09-26 0:00 ` [PATCHv3 2/3] gdb: Change a VEC to std::vector in btrace.{c,h} Andrew Burgess
2019-09-26 8:47 ` Metzger, Markus T
2019-09-26 11:33 ` Andrew Burgess
2019-09-26 0:00 ` [PATCHv3 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Andrew Burgess
2019-09-26 0:00 ` [PATCHv3 0/3] Remove some uses of VEC Andrew Burgess
2019-09-26 2:52 ` Simon Marchi
2019-09-26 11:41 ` [PATCHv4 1/3] gdb: Remove a VEC from gdbsupport/btrace-common.h Andrew Burgess
2019-09-26 13:40 ` Metzger, Markus T
2019-09-26 11:41 ` Andrew Burgess [this message]
2019-09-26 11:41 ` [PATCHv4 2/3] gdb: Change a VEC to std::vector in btrace.{c,h} Andrew Burgess
2019-09-26 11:41 ` [PATCHv4 0/3] Remove some uses of VEC Andrew Burgess
2019-10-01 11:42 ` [PATCHv5 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Andrew Burgess
2019-10-02 15:51 ` Pedro Alves
2019-10-02 22:21 ` Andrew Burgess
2019-10-03 8:06 ` Pedro Alves
2019-10-01 11:42 ` [PATCHv5 1/3] gdb: Remove a VEC from gdbsupport/btrace-common.h Andrew Burgess
2019-10-01 19:59 ` Tom Tromey
2019-10-01 11:42 ` [PATCHv5 2/3] gdb: Change a VEC to std::vector in btrace.{c,h} Andrew Burgess
[not found] ` <cover.1569929785.git.andrew.burgess@embecosm.com>
2019-10-01 12:04 ` [PATCHv5 0/3] Remove some uses of VEC Metzger, Markus T
2019-09-25 15:54 ` [PATCHv2 2/3] gdb: Change a VEC to std::vector in btrace.{c,h} Andrew Burgess
2019-09-26 2:35 ` Simon Marchi
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=0fd630a9283d9990aa0cd13f5fcbbc8f377a90fb.1569497661.git.andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.com \
--cc=simark@simark.ca \
--cc=tom@tromey.com \
/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