From patchwork Wed Dec 12 21:36:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 30653 Received: (qmail 19759 invoked by alias); 12 Dec 2018 21:36:35 -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 18764 invoked by uid 89); 12 Dec 2018 21:36:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Fall, cu, ICC X-HELO: mail-wr1-f47.google.com Received: from mail-wr1-f47.google.com (HELO mail-wr1-f47.google.com) (209.85.221.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Dec 2018 21:36:31 +0000 Received: by mail-wr1-f47.google.com with SMTP id q18so19157194wrx.9 for ; Wed, 12 Dec 2018 13:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id; bh=Gt+V+7v7dz0bb4FfI4+D0RaZqQ0cwXQlBMC7xelVmH4=; b=T0Nfes/BI/8iByX7FMY1stj41+Dy57FhXPtdwh2DDQCaAekwUn/S9Mwbsvj0klKVfs THlNLo2JolIgmZevbro65qdGbYp/d+pxP535043J+DvHTaUUKxDyKt5fKHIO0OC8QfJp /uYpCvQmrAkTgcTeLGfRauAqiu28MbGTpy5Pa9OUvp3VbbczRCbSuWaTRbTm+8dawJEl blJoGI8VmTYyR9VXD7QF2wHm2Fm071+XQJm8XxVJAP/8fmxaCqhhT9KHxPNwbVQACDJY IVpmTUhOjTCooKWcZZXeEOc28wNpyeIypzJTvgXl89jNLsMDIimE0CaDyAFik6/R8Vhx TZbA== Return-Path: Received: from localhost ([2a00:23c5:3e8d:6c00:9cd0:87cb:29bd:5b8f]) by smtp.gmail.com with ESMTPSA id w125sm194088wmb.45.2018.12.12.13.36.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 13:36:28 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/dwarf: Convert some predicates from int to bool Date: Wed, 12 Dec 2018 21:36:24 +0000 Message-Id: <20181212213624.27240-1-andrew.burgess@embecosm.com> X-IsSubscribed: yes In the dwarf reader we have a set of predicates, these include the different producer predicates and also some control predicates. The older ones are declared as integers, while newer ones (added since the C++ conversion) are bool. This commit makes them all bool for consistency. There should be no user visible change after this commit. gdb/ChangeLog: * dwarf2read.c (struct dwarf2_cu): Convert the fields 'mark', 'has_loclist', 'checked_producer', 'producer_is_gxx_lt_4_6', 'producer_is_gcc_lt_4_3', 'producer_is_icc_lt_14', 'processing_has_namespace_info' from unsigned int to bool. Update comments. (producer_is_icc_lt_14): Update return type. (producer_is_gcc_lt_4_3): Likewise. (producer_is_gxx_lt_4_6): Likewise. (process_die): Write true instead of 1 into predicate fields. (dwarf2_start_symtab): Likewise. (var_decode_location): Likewise. (dwarf2_mark_helper): Likewise. (dwarf2_mark): Likewise. (dwarf2_clear_marks): Write false instead of 0 into predicate field. (dwarf2_cu::dwarf2_cu): Initialise predicate fields to false, not 0. --- gdb/ChangeLog | 20 +++++++++++++++++++ gdb/dwarf2read.c | 58 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 30bc101f11c..bb8e923b02f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -536,30 +536,30 @@ struct dwarf2_cu std::vector rust_unions; /* Mark used when releasing cached dies. */ - unsigned int mark : 1; + bool mark : 1; /* This CU references .debug_loc. See the symtab->locations_valid field. This test is imperfect as there may exist optimized debug code not using any location list and still facing inlining issues if handled as unoptimized code. For a future better test see GCC PR other/32998. */ - unsigned int has_loclist : 1; + bool has_loclist : 1; - /* These cache the results for producer_is_* fields. CHECKED_PRODUCER is set + /* These cache the results for producer_is_* fields. CHECKED_PRODUCER is true if all the producer_is_* fields are valid. This information is cached because profiling CU expansion showed excessive time spent in producer_is_gxx_lt_4_6. */ - unsigned int checked_producer : 1; - unsigned int producer_is_gxx_lt_4_6 : 1; - unsigned int producer_is_gcc_lt_4_3 : 1; + bool checked_producer : 1; + bool producer_is_gxx_lt_4_6 : 1; + bool producer_is_gcc_lt_4_3 : 1; bool producer_is_icc : 1; - unsigned int producer_is_icc_lt_14 : 1; + bool producer_is_icc_lt_14 : 1; bool producer_is_codewarrior : 1; - /* When set, the file that we're processing is known to have + /* When true, the file that we're processing is known to have debugging info for C++ namespaces. GCC 3.3.x did not produce this information, but later versions do. */ - unsigned int processing_has_namespace_info : 1; + bool processing_has_namespace_info : 1; struct partial_die_info *find_partial_die (sect_offset sect_off); }; @@ -10648,21 +10648,21 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_common_inclusion: break; case DW_TAG_namespace: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; read_namespace (die, cu); break; case DW_TAG_module: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; read_module (die, cu); break; case DW_TAG_imported_declaration: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; if (read_namespace_alias (die, cu)) break; /* The declaration is not a global namespace alias. */ /* Fall through. */ case DW_TAG_imported_module: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; if (die->child != NULL && (die->tag == DW_TAG_imported_declaration || cu->language != language_fortran)) complaint (_("Tag '%s' has unexpected children"), @@ -11361,7 +11361,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) types, but gives them a size of zero. Starting with version 14, ICC is compatible with GCC. */ -static int +static bool producer_is_icc_lt_14 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -11387,7 +11387,7 @@ producer_is_icc (struct dwarf2_cu *cu) directory paths. GCC SVN r127613 (new option -fdebug-prefix-map) fixed this, it was first present in GCC release 4.3.0. */ -static int +static bool producer_is_gcc_lt_4_3 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -14929,14 +14929,14 @@ check_producer (struct dwarf2_cu *cu) compliant. */ } - cu->checked_producer = 1; + cu->checked_producer = true; } /* Check for GCC PR debug/45124 fix which is not present in any G++ version up to 4.5.any while it is present already in G++ 4.6.0 - the PR has been fixed during 4.6.0 experimental. */ -static int +static bool producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -21271,7 +21271,7 @@ dwarf2_start_symtab (struct dwarf2_cu *cu, cu->builder->record_debugformat ("DWARF 2"); cu->builder->record_producer (cu->producer); - cu->processing_has_namespace_info = 0; + cu->processing_has_namespace_info = false; return cu->builder->get_compunit_symtab (); } @@ -21338,7 +21338,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, dwarf2_symbol_mark_computed (attr, sym, cu, 0); if (SYMBOL_COMPUTED_OPS (sym)->location_has_loclist) - cu->has_loclist = 1; + cu->has_loclist = true; } /* Given a pointer to a DWARF information entry, figure out if we need @@ -25168,15 +25168,15 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, dwarf2_cu::dwarf2_cu (struct dwarf2_per_cu_data *per_cu_) : per_cu (per_cu_), - mark (0), - has_loclist (0), - checked_producer (0), - producer_is_gxx_lt_4_6 (0), - producer_is_gcc_lt_4_3 (0), + mark (false), + has_loclist (false), + checked_producer (false), + producer_is_gxx_lt_4_6 (false), + producer_is_gcc_lt_4_3 (false), producer_is_icc (false), - producer_is_icc_lt_14 (0), + producer_is_icc_lt_14 (false), producer_is_codewarrior (false), - processing_has_namespace_info (0) + processing_has_namespace_info (false) { per_cu->cu = this; } @@ -25509,7 +25509,7 @@ dwarf2_mark_helper (void **slot, void *data) if (per_cu->cu->mark) return 1; - per_cu->cu->mark = 1; + per_cu->cu->mark = true; if (per_cu->cu->dependencies != NULL) htab_traverse (per_cu->cu->dependencies, dwarf2_mark_helper, NULL); @@ -25525,7 +25525,7 @@ dwarf2_mark (struct dwarf2_cu *cu) { if (cu->mark) return; - cu->mark = 1; + cu->mark = true; if (cu->dependencies != NULL) htab_traverse (cu->dependencies, dwarf2_mark_helper, NULL); } @@ -25535,7 +25535,7 @@ dwarf2_clear_marks (struct dwarf2_per_cu_data *per_cu) { while (per_cu) { - per_cu->cu->mark = 0; + per_cu->cu->mark = false; per_cu = per_cu->cu->read_in_chain; } }