From patchwork Tue Oct 1 11:42:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 34761 Received: (qmail 59837 invoked by alias); 1 Oct 2019 11:42:37 -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 59724 invoked by uid 89); 1 Oct 2019 11:42:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 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-f53.google.com Received: from mail-wm1-f53.google.com (HELO mail-wm1-f53.google.com) (209.85.128.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Oct 2019 11:42:35 +0000 Received: by mail-wm1-f53.google.com with SMTP id b24so2850785wmj.5 for ; Tue, 01 Oct 2019 04:42:35 -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=n03ufd+CVyuOp6coPCZjmwVhYPDnzhu0whPGc//pf5U=; b=YxUKLRBF88QUjb909ZTDch72p13Fft/579r6XAwqZ/a2yDpbfjhu/dP6uEUOge/3hg ENbc4gwIUDoVMJlVFm3LxcpDm3ulJ3vvc/NI3LTW/tw9IJfxkBRrfgaY+3GDc0toyFO2 dxhjnHoms5TIw2tnNln5vFX8ECmjPhWdH2h4dqmzqbqnw35IcWyvu0j5Y3k3nv9FEPnD hxrnn2LO0fI1tmmPvqL4qzhTbwXnEYy2K01wLxT90ivNsmDb4SY383104nSpJZ1AQWoO Q1tNy0MqE6JeAe8PaZfG4LH3wzSn7W/7StsoVFPu86FXFohKhAH1CoCUAyAEZOSGLGD4 MgyQ== Return-Path: Received: from localhost (host86-128-12-122.range86-128.btcentralplus.com. [86.128.12.122]) by smtp.gmail.com with ESMTPSA id g1sm14436962wrv.68.2019.10.01.04.42.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Oct 2019 04:42:32 -0700 (PDT) From: Andrew Burgess To: gdb-patches Cc: Simon Marchi , Tom Tromey , markus.t.metzger@intel.com, Andrew Burgess Subject: [PATCHv5 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Date: Tue, 1 Oct 2019 12:42:26 +0100 Message-Id: <8686aa422a9296daf14b844071a05fd443aea850.1569929786.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 | 17 +++++++++-------- gdb/dwarf2read.h | 3 --- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 53e7393a7c9..30658b2d4f4 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 == 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. */