From patchwork Mon Mar 18 12:52:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31884 Received: (qmail 22896 invoked by alias); 18 Mar 2019 12:52:41 -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 22821 invoked by uid 89); 18 Mar 2019 12:52:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.8 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=supplies X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Mar 2019 12:52:39 +0000 Received: by mail-wm1-f65.google.com with SMTP id e74so12856413wmg.3 for ; Mon, 18 Mar 2019 05:52:38 -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=Fm+mehLGMU/gs6hT3414bT0rjlVrKgVRyqOv7Xu9Fi0=; b=g8liytkEM4H7PeYOU7dgugtAncsmv3FcjPxJZ28Q3MAWHIXUQQjTEGsOtr0rG3Tfvn dT2LgdQf4x3/uk8k766aHHEXtLSEPtSVNWOGtbD58wqU4yEUKc6g9/0Pq1la2KtkMwyw r1WQa0r1ixr5wa8nJPOo9t/ImzetoPUAfODuR3Ni0MnH+0LAc5uO7RBFHTAruorAzxWC Ck43vROpyg1S2ocxHexEzTaFCZXoScMQazhE3EfbYijwz/ZF31aG6Ct/SfUFGPqQKOt/ bw775KffOJTMD6zIrNhBuwRqmnZk46wpOBRxKLixYDYE3PQimt/NUYI1C0frAmgjfJAn hdeg== Return-Path: Received: from localhost (host86-142-70-198.range86-142.btcentralplus.com. [86.142.70.198]) by smtp.gmail.com with ESMTPSA id l8sm15646230wrv.45.2019.03.18.05.52.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Mar 2019 05:52:35 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 5/8] gdb/fortran: Print 'void' type in lower case Date: Mon, 18 Mar 2019 12:52:20 +0000 Message-Id: <6d0a648e363b5959d26c2065aea3fbe9da41c81a.1552913184.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes For a program compiled with gfortran the base type names are written as lower cases in the DWARF, and so GDB will display them as lower case. Additionally, in most places where GDB supplies its own type names (for example all of the types defined in f-lang.c in `build_fortran_types`), the type names are all lower case. An exception to this is where GDB prints the void type for Fortran. In this case GDB uses upper case. I'm not aware of any reason why this type should merit special attention, and it looks our of place when printing types, so this commit changes from 'VOID' to 'void' to match all the other types. gdb/ChangeLog: * f-lang.c (build_fortran_types): Change name of void type to lower case. * f-typeprint.c (f_type_print_base): Print the name of the void type, rather than a fixed string. * f-valprint.c (f_decorations): Use lower case void string. gdb/testsuite/ChangeLog: * gdb.fortran/exprs.exp (test_convenience_variables): Expect lower case void string. --- gdb/ChangeLog | 8 ++++++++ gdb/f-lang.c | 2 +- gdb/f-typeprint.c | 6 +++++- gdb/f-valprint.c | 2 +- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.fortran/exprs.exp | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51bbc6ad333..d8f752f6808 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2019-03-18 Andrew Burgess + + * f-lang.c (build_fortran_types): Change name of void type to + lower case. + * f-typeprint.c (f_type_print_base): Print the name of the void + type, rather than a fixed string. + * f-valprint.c (f_decorations): Use lower case void string. + 2019-03-18 Andrew Burgess Chris January diff --git a/gdb/f-lang.c b/gdb/f-lang.c index dd31b42ccd0..09a2df90e49 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -497,7 +497,7 @@ build_fortran_types (struct gdbarch *gdbarch) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_f_type); builtin_f_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "VOID"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_f_type->builtin_character = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 30e0c4dcda1..7e36ca16c69 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -329,7 +329,11 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, break; case TYPE_CODE_VOID: - fprintfi_filtered (level, stream, "VOID"); + { + gdbarch *gdbarch = get_type_arch (type); + struct type *void_type = builtin_f_type (gdbarch)->builtin_void; + fprintfi_filtered (level, stream, "%s", TYPE_NAME (void_type)); + } break; case TYPE_CODE_UNDEF: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index eee0a62fe88..b335a2b3b50 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -199,7 +199,7 @@ static const struct generic_val_print_decorations f_decorations = ")", ".TRUE.", ".FALSE.", - "VOID", + "void", "{", "}" }; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 83883cefd1e..3cdc3cfa6fc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-18 Andrew Burgess + + * gdb.fortran/exprs.exp (test_convenience_variables): Expect lower + case void string. + 2019-03-18 Andrew Burgess * gdb.fortran/complex.exp: Expand. diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp index 3b24f7c135f..8649d0b246d 100644 --- a/gdb/testsuite/gdb.fortran/exprs.exp +++ b/gdb/testsuite/gdb.fortran/exprs.exp @@ -141,7 +141,7 @@ proc test_convenience_variables {} { gdb_test "print (\$foo = 32) + 4" " = 36" \ "Use convenience variable assignment in arithmetic expression" - gdb_test "print \$bar" " = VOID" \ + gdb_test "print \$bar" " = void" \ "Print contents of uninitialized convenience variable" }