From patchwork Tue Feb 12 16:11:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31418 Received: (qmail 68451 invoked by alias); 12 Feb 2019 16:11:24 -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 68342 invoked by uid 89); 12 Feb 2019 16:11:24 -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= X-HELO: mail-wm1-f47.google.com Received: from mail-wm1-f47.google.com (HELO mail-wm1-f47.google.com) (209.85.128.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:11:22 +0000 Received: by mail-wm1-f47.google.com with SMTP id t200so3647353wmt.0 for ; Tue, 12 Feb 2019 08:11:22 -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=H3aZroKdSKH+Rgm5KT1LkDgoKT0eMEZnU4bj1nUq4cg=; b=NyNKD1y9jSecJEQ5cXsUtCdyKfMUuo9LfZuMwyZU0KIn+FuHzgduSfPvVDTI64yg+B DIondhkVZm2/fu/MVxgBQrmT3zLo626AwfX9c9aOHH8az+v30LAAcZOXxDLKwMIu+6rS elX3j4YPFmNjdrsdfPoN/4nwq5bx9uZ1MCTolEGtB0uzTH5Ct8QnpEVAjnKn0umkKtfQ fn5vTCAjwIsGDfgaWLYJmzSCsfoZ/NysO0JkZNT5Z5uUFlSD6QnKAG5WXInK2VXn+kEi kDtEKDylEt71p5zne7GX1JbtbLIASrj6JnTcQmAUIhnYv+KlBxEEO0RFwxXmYOfanyIm 9uIg== Return-Path: Received: from localhost (host81-151-161-9.range81-151.btcentralplus.com. [81.151.161.9]) by smtp.gmail.com with ESMTPSA id a62sm3509260wmf.47.2019.02.12.08.11.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 08:11:19 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 09/11] gdb/fortran: Use TYPE_CODE_CHAR for character types Date: Tue, 12 Feb 2019 16:11:00 +0000 Message-Id: <7b2f5773c3e241e4140c39acddc9abf2d5e6a57e.1549986233.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Switch to using TYPE_CODE_CHAR for character types. This appears to have little impact on the test results as gFortran uses the DW_TAG_string_type to represent all character variables (as far as I can see). The only place this has an impact is when the user casts a variable to a character type, in which case GDB does now use the CHAR type, and prints the variable as both a value and a character, for example, before: (gdb) p ((character) 97) $1 = 97 and after: (gdb) p ((character) 97) $1 = 97 'a' gdb/ChangeLog: * f-lang.c (build_fortran_types): Use TYPE_CODE_CHAR for character types. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Update expected results. --- gdb/ChangeLog | 5 +++++ gdb/f-lang.c | 2 +- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.fortran/type-kinds.exp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 7bed3189283..cbb3ad0f8a6 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -365,7 +365,7 @@ build_fortran_types (struct gdbarch *gdbarch) = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "VOID"); builtin_f_type->builtin_character - = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "character"); + = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); builtin_f_type->builtin_logical_s1 = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1"); diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp index 129997e4f66..0daa1ec6b12 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -23,7 +23,7 @@ if { [skip_fortran_tests] } { continue } # Test parsing of `(kind=N)` type modifiers. proc test_basic_parsing_of_type_kinds {} { - gdb_test "p ((character (kind=1)) 1)" " = 1" + gdb_test "p ((character (kind=1)) 1)" " = 1 '\\\\001'" gdb_test "p ((complex (kind=4)) 1)" " = \\(1,0\\)" gdb_test "p ((complex (kind=8)) 1)" " = \\(1,0\\)"