From patchwork Wed Sep 25 15:54:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 34657 Received: (qmail 61675 invoked by alias); 25 Sep 2019 15:54:36 -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 61535 invoked by uid 89); 25 Sep 2019 15:54:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=tus X-HELO: mail-wm1-f41.google.com Received: from mail-wm1-f41.google.com (HELO mail-wm1-f41.google.com) (209.85.128.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Sep 2019 15:54:34 +0000 Received: by mail-wm1-f41.google.com with SMTP id a6so6286614wma.5 for ; Wed, 25 Sep 2019 08:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=iMTkideSXLbP/B5tf+0u9diCiQo3rGokh662BsXJB8c=; b=hlZ8fRbcviFd5qfN189rioEpuKwviRzikq3oIZo+Acs2rbByKKgQ7bYhyD4tgoOP09 aFPAVa39lpPJVZMtD2KXadcpS++IfE99Ah2XCNp0dImZCK0hmaLGdK6K3k8os0gOijLK CKxInK9xcUaNAS4V6LQkT+drNYdcuyPmUzYoYXIk2/JDV6qdyPOax9WIuxuvM8eMpDhL gLM6bBG+ibFKV1pAbdaP5F+TFy5/cH22X2k34MTPzGRLY2A9pcGmKb4ACbQO7/nQD6yH AhC0K6RfwCaFGxqDFul/Ut0VJPlQNpTfeqc3+0NnJt7cn89PrK7urTQ/HMSTWblINsje mozQ== Return-Path: Received: from localhost (host86-128-12-122.range86-128.btcentralplus.com. [86.128.12.122]) by smtp.gmail.com with ESMTPSA id g11sm3998094wmh.45.2019.09.25.08.54.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Sep 2019 08:54:32 -0700 (PDT) From: Andrew Burgess To: gdb-patches Cc: Simon Marchi , Tom Tromey , Andrew Burgess Subject: [PATCHv2 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Date: Wed, 25 Sep 2019 16:54:25 +0100 Message-Id: <0dcd5cbc1c863f32bbc513db657e3c2aec2dadb7.1569425799.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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) : 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 | 16 ++++++++-------- gdb/dwarf2read.h | 3 --- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 1052501c351..7cc0dc3c92d 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 *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 ; + 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->size (); int i; gdb_assert (len > 0); @@ -8350,16 +8351,15 @@ 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 < tu_group->tus->size (); ++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; 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. */