From patchwork Wed Mar 6 18:15:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31748 Received: (qmail 36415 invoked by alias); 6 Mar 2019 18:16:00 -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 36004 invoked by uid 89); 6 Mar 2019 18:15:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=BAYES_00, DNS_FROM_AHBL_RHSBL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.1 spammy=HX-Received:600c X-HELO: mail-wm1-f54.google.com Received: from mail-wm1-f54.google.com (HELO mail-wm1-f54.google.com) (209.85.128.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Mar 2019 18:15:27 +0000 Received: by mail-wm1-f54.google.com with SMTP id f3so6905644wmj.4 for ; Wed, 06 Mar 2019 10:15:24 -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=jr01hu4AjIl0H1DQX3MhZpn/AL/AtSw+RBiOgseUp+4=; b=c9kdr2bFyj7ajMYxDW9ux9pbcQYOLMhrf4jgf6ga1kXET4Sk4Av/KWDWIx9CfGSiUq LfRV8X9uFsvbrGMMLuryRTPOYPiqIVWZUNz9nVerdoJUnp2ANMeLbyIQiYEf/4oRGM4x APyBWEpMXGH3exIjxu10qj5gMShged0eZmA7Sbl3qmEE8KM+i+MOR2wO7z47BiOmdxPb FEZP7wolDEh8crZQyvUPSMGjUcF1x6EkCU+u42Zp3oOEgDf8gD1XhiV8ClBB4yFX39NS vSY5D50XfE/pThd6+ghOYUvTq3Ja9d2vaTJ5l0r+4s4hkA9hMIkuOqn0RA523X++eV2x 3TNw== Return-Path: Received: from localhost (host86-142-70-198.range86-142.btcentralplus.com. [86.142.70.198]) by smtp.gmail.com with ESMTPSA id o12sm6235001wre.0.2019.03.06.10.15.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2019 10:15:21 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED 09/11] gdb/fortran: Use TYPE_CODE_CHAR for character types Date: Wed, 6 Mar 2019 18:15:02 +0000 Message-Id: <382ff8410f7cc0d02661e2e00812f1eec487ee27.1551895529.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 f27eb0d45da..c329d602e24 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -366,7 +366,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 198ac58baf4..b5d4e7b5816 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -38,7 +38,7 @@ proc test_cast_1_to_type_kind {base_type type_kind cast_result size_result} { # Test parsing of `(kind=N)` type modifiers. proc test_basic_parsing_of_type_kinds {} { - test_cast_1_to_type_kind "character" "1" "1" "1" + test_cast_1_to_type_kind "character" "1" "1 '\\\\001'" "1" test_cast_1_to_type_kind "complex" "4" "\\(1,0\\)" "8" test_cast_1_to_type_kind "complex" "8" "\\(1,0\\)" "16"