OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.fortran/] [subarray.exp] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see .
15
 
16
# This file was written by Wu Zhou. (woodzltc@cn.ibm.com)
17
 
18
# This file is part of the gdb testsuite.  It contains tests for evaluating
19
# Fortran subarray expression.
20
 
21
if $tracelevel then {
22
        strace $tracelevel
23
}
24
 
25
if { [skip_fortran_tests] } { return -1 }
26
 
27
set testfile "subarray"
28
set srcfile ${testfile}.f
29
set binfile ${objdir}/${subdir}/${testfile}
30
 
31
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
32
        executable {debug f77}] != ""} {
33
    return -1
34
}
35
 
36
gdb_exit
37
gdb_start
38
gdb_reinitialize_dir $srcdir/$subdir
39
gdb_load ${binfile}
40
 
41
if ![runto MAIN__] then {
42
    perror "couldn't run to breakpoint MAIN__"
43
    continue
44
}
45
 
46
# Try to set breakpoint at the last write statement.
47
 
48
set bp_location [gdb_get_line_number "str(:)"]
49
gdb_test "break $bp_location" \
50
    "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
51
    "breakpoint at the last write statement"
52
gdb_test "continue" \
53
    "Continuing\\..*Breakpoint.*" \
54
    "continue to breakpoint"
55
 
56
# Test four different kinds of subarray expression evaluation.
57
 
58
set test "print str(2:4)"
59
gdb_test_multiple $test $test {
60
    -re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" {
61
        pass $test
62
    }
63
    -re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" {
64
        # Compiler should produce string, not an array of characters.
65
        setup_xfail "*-*-*"
66
        fail $test
67
    }
68
}
69
 
70
set test "print str(:3)"
71
gdb_test_multiple $test $test {
72
    -re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" {
73
        pass $test
74
    }
75
    -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" {
76
        # Compiler should produce string, not an array of characters.
77
        setup_xfail "*-*-*"
78
        fail $test
79
    }
80
}
81
 
82
set test "print str(5:)"
83
gdb_test_multiple $test $test {
84
    -re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" {
85
        pass $test
86
    }
87
    -re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
88
        # Compiler should produce string, not an array of characters.
89
        setup_xfail "*-*-*"
90
        fail $test
91
    }
92
}
93
 
94
set test "print str(:)"
95
gdb_test_multiple $test $test {
96
    -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" {
97
        pass $test
98
    }
99
    -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
100
        # Compiler should produce string, not an array of characters.
101
        setup_xfail "*-*-*"
102
        fail $test
103
    }
104
}
105
 
106
gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)"
107
gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)"
108
gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)"
109
gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.