From patchwork Thu Sep 26 11:41:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 34680 Received: (qmail 14545 invoked by alias); 26 Sep 2019 11:41:26 -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 14487 invoked by uid 89); 26 Sep 2019 11:41:26 -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= X-HELO: mail-wr1-f48.google.com Received: from mail-wr1-f48.google.com (HELO mail-wr1-f48.google.com) (209.85.221.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Sep 2019 11:41:23 +0000 Received: by mail-wr1-f48.google.com with SMTP id r3so2356281wrj.6 for ; Thu, 26 Sep 2019 04:41:23 -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=P0K4UEcVTZoVd/p2pGR1PDyGroH+W7x8YFoHTyWTtjg=; b=b///HFGyvK6jppbteHp3JgYpT86zsF6JoLupgrFNVIhelRkh/1IYggwFslCpsmdUnP JqlHWTRbxI/T3Ehwx3xGvXi2FRAvDEOSYlEalZnQ91L51XUuUf1YRo2allbTHEcsNDPo vb9XR7TadM2qsMeuVvYIENLstzgj4E9f5tehB0Emm6wk107RPpB4ewazFJUO4QMIwuTY vOdfT+FVG4GPfZm1O0gJGQtK7ANLaWbIAE+mKlOlTOC+W7D7Pb0REqxnfU66Ye2SJrTi cLrIIGHUPGOXwkg4Di2ApsXnLvNlN+/EFiel+wtWkgCSx2E9LI/72Or92HW4jwAwJiKA n7WA== Return-Path: Received: from localhost (host86-128-12-122.range86-128.btcentralplus.com. [86.128.12.122]) by smtp.gmail.com with ESMTPSA id v64sm2273875wmf.12.2019.09.26.04.41.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 04:41:20 -0700 (PDT) From: Andrew Burgess To: gdb-patches Cc: Simon Marchi , Tom Tromey , markus.t.metzger@intel.com, Andrew Burgess Subject: [PATCHv4 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h} Date: Thu, 26 Sep 2019 12:41:14 +0100 Message-Id: <0fd630a9283d9990aa0cd13f5fcbbc8f377a90fb.1569497661.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 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 *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. */