[RFA] New testcase to evaluate Fortran substring expression
Wu Zhou
woodzltc@cn.ibm.com
Wed Jun 22 04:02:00 GMT 2005
Sorry, I miss-typed the mail address. Original text is as follows:
---------- Forwarded message ----------
Date: Wed, 22 Jun 2005 10:39:48 +0800 (CST)
From: Wu Zhou <woodzltc@cn.ibm.com>
To: gdb-patches@cn.ibm.com
Cc: eliz@gnu.org, drow@false.org
Subject: [RFA] New testcase to evaluate Fortran substring expression
Eli/Daniel and all,
Here is my new testcase to evaluate Fortran substring expression. The
intention is to test whehter current GDB could correctly handle substring
expression evaluation of Fortran. I tested it against g77-3.2.3 and
gfortran-4.0.0. The last four tests failed for both configuration.
I am also thinking of fixing these errors. It is easy to fix str(exp:exp)
and str(:), but I am not sure how to fix str(:exp) and str(exp:) yet. Any
hints/tips on this? TIA.
2005-06-22 Wu Zhou <woodzltc@cn.ibm.com>
* gdb.fortran/substring.f: New file.
* gdb.fortran/substring.exp: New testcase.
*** /dev/null 2005-06-19 07:34:09.109204120 +0800
--- gdb.fortran/substring.f 2005-06-21 02:28:32.000000000 +0800
***************
*** 0 ****
--- 1,31 ----
+ c Copyright 2005 Free Software Foundation, Inc.
+
+ c This program is free software; you can redistribute it and/or modify
+ c it under the terms of the GNU General Public License as published by
+ c the Free Software Foundation; either version 2 of the License, or
+ c (at your option) any later version.
+ c
+ c This program is distributed in the hope that it will be useful,
+ c but WITHOUT ANY WARRANTY; without even the implied warranty of
+ c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ c GNU General Public License for more details.
+ c
+ c You should have received a copy of the GNU General Public License
+ c along with this program; if not, write to the Free Software
+ c Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ c Ihis file is the Fortran source file for substring.exp. It was written
+ c by Wu Zhou. (woodzltc@cn.ibm.com)
+
+ PROGRAM substring
+
+ character *26 str
+
+ str = 'abcdefghijklmnopqrstuvwxyz'
+
+ write (*, *) str(1:7)
+ write (*, *) str(:7)
+ write (*, *) str(20:)
+ write (*, *) str(:)
+
+ END PROGRAM
*** /dev/null 2005-06-19 07:34:09.109204120 +0800
--- gdb.fortran/substring.exp 2005-06-22 10:32:41.000000000 +0800
***************
*** 0 ****
--- 1,60 ----
+ # Copyright 2005 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 2 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, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ # This file was written by Wu Zhou. (woodzltc@cn.ibm.com)
+
+ # This file is part of the gdb testsuite. It contains tests for evaluating
+ # Fortran substring expression
+
+ if $tracelevel then {
+ strace $tracelevel
+ }
+
+ set testfile "substring"
+ set srcfile ${testfile}.f
+ set binfile ${objdir}/${subdir}/${testfile}
+
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+ }
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint sub_"
+ continue
+ }
+
+ # Try to set breakpoint at the last write statement.
+
+ set bp_location [gdb_get_line_number "str(:)"]
+ gdb_test "break $bp_location" \
+ "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
+ "breakpoint at the last write statement"
+ gdb_test "continue" \
+ "Continuing\\..*Breakpoint.*" \
+ "continue to breakpoint"
+
+ # Test four different kinds of substring expression evaluation.
+
+ gdb_test "print str(1:7)" ".*1 = .*" "print str(1:7)"
+ gdb_test "print str(:7)" ".*2 = .*" "print str(:7)"
+ gdb_test "print str(20:)" ".*3 = .*" "print str(20:)"
+ gdb_test "print str(:)" ".*4 = .*" "print str(:)"
Cheers
- Wu Zhou
More information about the Gdb-patches
mailing list