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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.cp/] [bs15503.exp] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 1992, 2004, 2005, 2007, 2008 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
# Test case for CLLbs15503
17
# This file was written by Sue Kimura (sue_kimura@hp.com)
18
# Rewritten by Michael Chastain (mec.gnu@mindspring.com)
19
 
20
if $tracelevel {
21
    strace $tracelevel
22
}
23
 
24
if { [skip_cplus_tests] } { continue }
25
 
26
# On SPU this test fails because the executable exceeds local storage size.
27
if { [istarget "spu*-*-*"] } {
28
        return 0
29
}
30
 
31
set testfile "bs15503"
32
set srcfile ${testfile}.cc
33
set binfile ${objdir}/${subdir}/${testfile}
34
 
35
if [get_compiler_info ${binfile}] {
36
    return -1
37
}
38
 
39
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug c++"] != "" } {
40
    perror "Couldn't compile ${srcfile}"
41
    return -1
42
}
43
 
44
gdb_exit
45
gdb_start
46
gdb_reinitialize_dir $srcdir/$subdir
47
gdb_load ${binfile}
48
 
49
if ![runto_main] then {
50
    perror "couldn't run to breakpoint"
51
    continue
52
}
53
 
54
# Set breakpoint on template function
55
 
56
gdb_test "break StringTest::testFunction" \
57
    "Breakpoint $decimal at $hex: file .*${srcfile}, line $decimal."
58
 
59
gdb_test "continue" \
60
    ".*Breakpoint $decimal, StringTest::testFunction \\(this=$hex\\).*" \
61
    "continue to StringTest"
62
 
63
# Run to some random point in the middle of the function.
64
 
65
gdb_breakpoint [gdb_get_line_number "find position where blank needs to be inserted"]
66
gdb_continue_to_breakpoint "find position where blank needs to be inserted"
67
 
68
# Call some string methods.
69
 
70
gdb_test "print s.length()"             "\\$\[0-9\]+ = 42"
71
gdb_test "print s\[0\]"                 "\\$\[0-9\]+ =.* 'I'"
72
gdb_test "print s\[s.length()-1\]"      "\\$\[0-9\]+ =.* 'g'"
73
gdb_test "print (const char *) s" \
74
    "\\$\[0-9\]+ = $hex \"I am a short stringand now a longer string\""
75
 
76
# TODO: tests that do not work with gcc 2.95.3
77
# -- chastain 2004-01-07
78
#
79
# gdb_test "print s.compare(s)"         "\\$\[0-9\]+ = 0"
80
# gdb_test "print s.compare(\"AAA\")"     "\\$\[0-9\]+ = 1"
81
# gdb_test "print s.compare(\"ZZZ\")"     "\\$\[0-9\]+ = -1"
82
 
83
# TODO: tests that do not work with gcc 2.95.3 and gcc 3.3.2.
84
# cannot call overloaded non-member operator.  -- chastain 2004-01-07
85
#
86
# gdb_test "print s == s"                       "\\$\[0-9\]+ = true"
87
# gdb_test "print s > "AAA"                     "\\$\[0-9\]+ = true"
88
# gdb_test "print s < "ZZZ"                     "\\$\[0-9\]+ = true"
89
 
90
# TODO: GDB doesn't know to convert the string to a const char *, and
91
# instead tries to use the string as a structure initializer.
92
#
93
# gdb_test "print s == \"I am a short stringand now a longer string\"" \
94
#     "\\$\[0-9\]+ = true"
95
 
96
gdb_test "print (const char *) s.substr(0,4)"   "\\$\[0-9\]+ = $hex \"I am\""
97
gdb_test "print (const char *) (s=s.substr(0,4))" \
98
    "\\$\[0-9\]+ = $hex \"I am\""
99
 
100
# TODO: cannot call overloaded non-member operator again.
101
# -- chastain 2004-01-07
102
#
103
# gdb_test "print (const char *) (s + s)" \
104
#    "\\$\[0-9\]+ = $hex \"I amI am\""
105
# gdb_test "print (const char *) (s + \" \" + s)" \
106
#    "\\$\[0-9\]+ = $hex \"I am I am\""

powered by: WebSVN 2.1.0

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