From patchwork Sun May 5 20:57:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 32564 Received: (qmail 67591 invoked by alias); 5 May 2019 20:57:17 -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 67514 invoked by uid 89); 5 May 2019 20:57:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 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=prop, sk:propert, sk:get_sel, VALUE X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 05 May 2019 20:57:14 +0000 Received: by mail-wm1-f66.google.com with SMTP id y2so13016687wmi.5 for ; Sun, 05 May 2019 13:57:14 -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=wr2+/RNRIVeEFfhhQdbgcPUYiepIj76Hi8xFl0f5/QY=; b=YHxd+iFc0OqfeXSoUdleW7ZNn+msIND7Q4xFdCLfYqqThQx+aCep+FglsKddXoZ9h0 BOKeJZu7GM2VDxhO5vZmwwz61nTf0mJJ5mtiGy+sT0thvWCd3VnNmF6pYn5xJPUjSb3C UeldTQkdbL/XqbTJfcZ53OsdxrGhH/Uj4+Wg9lpvkR69uHl5Vivi3truTgGF1DkEkkRh HgQV9dNXNfKWemrRQ51EdnLG5UbqR/hbEPFGEH+S9PZkSzGvxAhCEFnrGDu6I/4p6NCf 1P5a4usJOAAqbHw9V5bLYSzpBhaDLqx3Ot3JbsBIPSuG2MtW4HdTDjr6Q+EyIcACMven Xwsw== Return-Path: Received: from localhost (host109-154-100-57.range109-154.btcentralplus.com. [109.154.100.57]) by smtp.gmail.com with ESMTPSA id j13sm27332995wrd.88.2019.05.05.13.57.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 May 2019 13:57:11 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/3] gdb: Convert dwarf2_evaluate_property to return bool Date: Sun, 5 May 2019 21:57:01 +0100 Message-Id: <6833f5415d7c517b3fea172e3383d74563274e4f.1557088062.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Convert dwarf2_evaluate_property to return a bool, there should be no user visible change after this commit. gdb/ChangeLog: * dwarf2loc.c (dwarf2_evaluate_property): Change return type, and update return statements. * dwarf2loc.h (dwarf2_evaluate_property): Update return type on declaration, and update comment to match. * gdbtypes.c (resolve_dynamic_array): Update call to dwarf2_evaluate_property to match new return type. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2loc.c | 14 +++++++------- gdb/dwarf2loc.h | 12 ++++++------ gdb/gdbtypes.c | 5 +---- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index bd630ee0588..411bf2912b2 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2424,14 +2424,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, /* See dwarf2loc.h. */ -int +bool dwarf2_evaluate_property (const struct dynamic_prop *prop, struct frame_info *frame, struct property_addr_info *addr_stack, CORE_ADDR *value) { if (prop == NULL) - return 0; + return false; if (frame == NULL && has_stack_frames ()) frame = get_selected_frame (NULL); @@ -2453,7 +2453,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, *value = value_as_address (val); } - return 1; + return true; } } break; @@ -2475,7 +2475,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, if (!value_optimized_out (val)) { *value = value_as_address (val); - return 1; + return true; } } } @@ -2483,7 +2483,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, case PROP_CONST: *value = prop->data.const_val; - return 1; + return true; case PROP_ADDR_OFFSET: { @@ -2505,11 +2505,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, val = value_at (baton->offset_info.type, pinfo->addr + baton->offset_info.offset); *value = value_as_address (val); - return 1; + return true; } } - return 0; + return false; } /* See dwarf2loc.h. */ diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index 955e6f1b48a..ac1a771a9f3 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -135,13 +135,13 @@ struct property_addr_info property. When evaluating a property that is not related to a type, it can be NULL. - Returns 1 if PROP could be converted and the static value is passed back - into VALUE, otherwise returns 0. */ + Returns true if PROP could be converted and the static value is passed + back into VALUE, otherwise returns false. */ -int dwarf2_evaluate_property (const struct dynamic_prop *prop, - struct frame_info *frame, - struct property_addr_info *addr_stack, - CORE_ADDR *value); +bool dwarf2_evaluate_property (const struct dynamic_prop *prop, + struct frame_info *frame, + struct property_addr_info *addr_stack, + CORE_ADDR *value); /* A helper for the compiler interface that compiles a single dynamic property to C code. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b3424d81be4..fe52a64f212 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2065,10 +2065,7 @@ resolve_dynamic_array (struct type *type, prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type); if (prop != NULL) { - int prop_eval_ok - = dwarf2_evaluate_property (prop, NULL, addr_stack, &value); - - if (prop_eval_ok) + if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) { remove_dyn_prop (DYN_PROP_BYTE_STRIDE, type); bit_stride = (unsigned int) (value * 8);