From patchwork Mon Aug 21 12:19:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wiederhake, Tim" X-Patchwork-Id: 22258 Received: (qmail 32407 invoked by alias); 21 Aug 2017 12:20: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 32139 invoked by uid 89); 21 Aug 2017 12:20:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Aug 2017 12:20:11 +0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2017 05:20:09 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga005.fm.intel.com with ESMTP; 21 Aug 2017 05:20:08 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id v7LCK72d032641; Mon, 21 Aug 2017 13:20:07 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id v7LCK055012957; Mon, 21 Aug 2017 14:20:00 +0200 Received: (from twiederh@localhost) by ulvlx001.iul.intel.com with LOCAL id v7LCK0BJ012953; Mon, 21 Aug 2017 14:20:00 +0200 From: Tim Wiederhake To: gdb-patches@sourceware.org Cc: Christoph Weinmann Subject: [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file. Date: Mon, 21 Aug 2017 14:19:26 +0200 Message-Id: <1503317966-12486-5-git-send-email-tim.wiederhake@intel.com> In-Reply-To: <1503317966-12486-1-git-send-email-tim.wiederhake@intel.com> References: <1503317966-12486-1-git-send-email-tim.wiederhake@intel.com> X-IsSubscribed: yes From: Christoph Weinmann Remove code relevant for printing C/C++ Integer values in a Fortran specific file to unify printing of Fortran values. xxxx-yy-zz Christoph Weinmann gdb/ChangeLog: * f-valprint.c (f_val_print): Remove check for one byte sized integers. Remove printing of character type. gdb/testsuite/ChangeLog: * gdb.fortran/printing-types.exp: New file. * gdb.fortran/printing-types.exp: New file. --- gdb/f-valprint.c | 18 ++------------ gdb/testsuite/gdb.fortran/printing-types.exp | 35 ++++++++++++++++++++++++++++ gdb/testsuite/gdb.fortran/printing-types.f90 | 27 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 gdb/testsuite/gdb.fortran/printing-types.exp create mode 100644 gdb/testsuite/gdb.fortran/printing-types.f90 diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 4234447..8fc894a 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -310,22 +310,8 @@ f_val_print (struct type *type, int embedded_offset, original_value, &opts, 0, stream); } else - { - val_print_scalar_formatted (type, embedded_offset, - original_value, options, 0, stream); - /* C and C++ has no single byte int type, char is used instead. - Since we don't know whether the value is really intended to - be used as an integer or a character, print the character - equivalent as well. */ - if (TYPE_LENGTH (type) == 1) - { - LONGEST c; - - fputs_filtered (" ", stream); - c = unpack_long (type, valaddr + embedded_offset); - LA_PRINT_CHAR ((unsigned char) c, type, stream); - } - } + val_print_scalar_formatted (type, embedded_offset, + original_value, options, 0, stream); break; case TYPE_CODE_STRUCT: diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp new file mode 100644 index 0000000..085de4f --- /dev/null +++ b/gdb/testsuite/gdb.fortran/printing-types.exp @@ -0,0 +1,35 @@ +# Copyright 2017 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +if {[skip_fortran_tests]} { return -1 } + +standard_testfile .f90 + +if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { + return -1 +} + +if {![runto MAIN__]} then { + untested "Could not run to breakpoint MAIN__" + return -1 +} + +gdb_breakpoint [gdb_get_line_number "write"] +gdb_continue_to_breakpoint "write" + +gdb_test "print oneByte" " = 1" +gdb_test "print twobytes" " = 2" +gdb_test "print chvalue" " = \'a\'" +gdb_test "print logvalue" " = \.TRUE\." diff --git a/gdb/testsuite/gdb.fortran/printing-types.f90 b/gdb/testsuite/gdb.fortran/printing-types.f90 new file mode 100644 index 0000000..749aa7c --- /dev/null +++ b/gdb/testsuite/gdb.fortran/printing-types.f90 @@ -0,0 +1,27 @@ +! Copyright 2017 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see . + +program prog + integer(1) :: oneByte + integer(2) :: twoBytes + character :: chValue + logical(1) :: logValue + + oneByte = 1 + twoBytes = 2 + chValue = 'a' + logValue = .true. + write(*,*) s +end