From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22860 invoked by alias); 24 Sep 2013 14:44:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 22848 invoked by uid 89); 24 Sep 2013 14:44:02 -0000 Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Sep 2013 14:44:02 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.3.2 X-HELO: mga01.intel.com Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 24 Sep 2013 07:44:00 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 24 Sep 2013 07:43:59 -0700 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [172.28.50.125]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id r8OEhwpK002717; Tue, 24 Sep 2013 15:43:58 +0100 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [127.0.0.1]) by ulliclel004.iul.intel.com (8.13.8/8.12.8/MailSET/client) with ESMTP id r8OEhvYE022522; Tue, 24 Sep 2013 16:43:57 +0200 Received: (from ctweinma@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id r8OEhpRc022521; Tue, 24 Sep 2013 16:43:51 +0200 From: Christoph Weinmann To: tromey@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH] Remove C/C++ relevant code in Fortran specific file. Date: Tue, 24 Sep 2013 14:44:00 -0000 Message-Id: <1380033831-22490-1-git-send-email-christoph.t.weinmann@intel.com> X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00862.txt.bz2 Remove code relevant for printing C/C++ Integer values in a Fortran specific file to unify printing of Fortran values. 2013-09-24 Christoph Weinmann * f-valprint.c (f_val_print): Remove check for one byte sized integers. Remove printing of character type. testsuite/ * gdb.fortran/printing-types.exp: Add test program for printing one and two byte sized Integers, character and logical type. * gdb.fortran/printing-types.exp: Add test case for printing one and two byte size Integers, character, and logical type. Change-Id: I9ac9d718b6a65c039b5814938ddb5e42ef225f3d --- gdb/f-valprint.c | 16 +-------- gdb/testsuite/gdb.fortran/printing-types.exp | 49 ++++++++++++++++++++++++++ gdb/testsuite/gdb.fortran/printing-types.f90 | 32 +++++++++++++++++ 3 files changed, 82 insertions(+), 15 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 d01d6ec..f267ad1 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -354,21 +354,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, original_value, options, 0, stream); } else - { - val_print_type_code_int (type, valaddr + embedded_offset, 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_type_code_int (type, valaddr + embedded_offset, 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..b72f2ba --- /dev/null +++ b/gdb/testsuite/gdb.fortran/printing-types.exp @@ -0,0 +1,49 @@ +# Copyright 2013 Free Software Foundation, Inc. + +# Contributed by Intel Corp. + +# 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 { + perror "Could not run to breakpoint MAIN__" + continue +} + +set bp_location [gdb_get_line_number "BP1"] + +gdb_test "break $bp_location" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \ + "Breakpoint at BP1" + +gdb_continue_to_breakpoint "write" + +# Check the printed output of small data types. +gdb_test "print oneByte" ".* = 1.*" "Print the value of a one byte sized Integer type." + +gdb_test "print twobytes" ".*2 = 2.*" "Print the value of a two bytes sized Integer type." + +gdb_test "print chvalue" ".*3 = \'a\'.*" "Print the value of a Character type." + +gdb_test "print logvalue" ".*4 = \.TRUE\..*" "Print the value of a Logical type." + diff --git a/gdb/testsuite/gdb.fortran/printing-types.f90 b/gdb/testsuite/gdb.fortran/printing-types.f90 new file mode 100644 index 0000000..da17dbe --- /dev/null +++ b/gdb/testsuite/gdb.fortran/printing-types.f90 @@ -0,0 +1,32 @@ +! Test file for printing simple types in Fortran. + +! Copyright 2013 Free Software Foundation, Inc. + +! Contributed by Intel Corp. + +! 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. + oneByte = 2 !BP1 +end + -- 1.7.0.7