From patchwork Tue Feb 12 16:10:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31412 Received: (qmail 67166 invoked by alias); 12 Feb 2019 16:11:16 -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 67120 invoked by uid 89); 12 Feb 2019 16:11:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=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.2 spammy=sk:complet, restructure, Expression, *exp X-HELO: mail-wr1-f46.google.com Received: from mail-wr1-f46.google.com (HELO mail-wr1-f46.google.com) (209.85.221.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:11:14 +0000 Received: by mail-wr1-f46.google.com with SMTP id o17so3320790wrw.3 for ; Tue, 12 Feb 2019 08:11:14 -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:in-reply-to:references :in-reply-to:references; bh=31m8Ab3rc1CZIlU4cZkgPTm7igeYqpyWZPBtL5amSGU=; b=VehEW79lPo5m4QtV4uKLVP4sLY/f6RrnNWvH7NyvzRx7puXYF7Bgy1eCsRfLB+9CIW uqoWeMCO5rQbZ87LxLE1sPAFUvepr7JQzJNSRmFyh4AsKN+qLCbXpMBcE7mjbkMKeNBp GawEzKTaGGRWjE1cBy+UKK7k9zBjm2WqBu9aiPcH/Bia/pp78sd9CMHLhW5P6mTSAiHq Kf4Mgi/jBD6+NAzxjQgNzFmhDqh2oxK3pIgthgPWSlpQzjP9Lw+6ndcFWF/PWM369IXI w4Sw56KtqpGVoPnhOedkiwdB+KjrTrmUd9pMjku5Hlnxfn5xBpjADVQVFFTHrCQMpXXo PUGA== Return-Path: Received: from localhost (host81-151-161-9.range81-151.btcentralplus.com. [81.151.161.9]) by smtp.gmail.com with ESMTPSA id a62sm3508735wmf.47.2019.02.12.08.11.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 08:11:11 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 04/11] gdb/fortran: Add new function to evaluate Fortran expressions Date: Tue, 12 Feb 2019 16:10:55 +0000 Message-Id: <5c5ee058f80a793f7861fa465c4c6ca4b73c222c.1549986233.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This is an initial restructure, it adds a new function in which Fortran specific expressions can be evaluated. No Fortran specific expressions are added with this commit though, so for now, the new function just forwards all expressions to the default expression handler, as such, there should be no user visible changes after this commit. However, the new function will be useful in later commits. gdb/ChangeLog: * f-lang.c (evaluate_subexp_f): New function. (exp_descriptor_f): New global. (f_language_defn): Use exp_descriptor_f instead of exp_descriptor_standard. --- gdb/ChangeLog | 7 +++++++ gdb/f-lang.c | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 4ff828ba753..779fb1e67fb 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -238,6 +238,15 @@ f_collect_symbol_completion_matches (completion_tracker &tracker, text, word, ":", code); } +/* Special expression evaluation cases for Fortran. */ +struct value * +evaluate_subexp_f (struct type *expect_type, struct expression *exp, + int *pos, enum noside noside) +{ + /* Currently no special handling is required. */ + return evaluate_subexp_standard (expect_type, exp, pos, noside); +} + static const char *f_extensions[] = { ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP", @@ -245,6 +254,17 @@ static const char *f_extensions[] = NULL }; +/* Expression processing for Fortran. */ +static const struct exp_descriptor exp_descriptor_f = +{ + print_subexp_standard, + operator_length_standard, + operator_check_standard, + op_name_standard, + dump_subexp_body_standard, + evaluate_subexp_f +}; + extern const struct language_defn f_language_defn = { "fortran", @@ -255,7 +275,7 @@ extern const struct language_defn f_language_defn = array_column_major, macro_expansion_no, f_extensions, - &exp_descriptor_standard, + &exp_descriptor_f, f_parse, /* parser */ null_post_parser, f_printchar, /* Print character constant */