OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.cp/] [class2.exp] - Blame information for rev 524

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

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2003, 2004, 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
if $tracelevel then {
17
    strace $tracelevel
18
    }
19
 
20
if { [skip_cplus_tests] } { continue }
21
 
22
 
23
set testfile "class2"
24
set srcfile ${testfile}.cc
25
set binfile ${objdir}/${subdir}/${testfile}
26
 
27
# Create and source the file that provides information about the compiler
28
# used to compile the test case.
29
if [get_compiler_info ${binfile} "c++"] {
30
    return -1
31
}
32
 
33
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
34
    untested class2.exp
35
    return -1
36
}
37
 
38
gdb_exit
39
gdb_start
40
gdb_reinitialize_dir $srcdir/$subdir
41
gdb_load ${binfile}
42
 
43
# Start with "set print object off".
44
 
45
gdb_test_no_output "set print object off"
46
 
47
if ![runto_main] then {
48
    perror "couldn't run to main"
49
    continue
50
}
51
 
52
get_debug_format
53
 
54
gdb_test "break [gdb_get_line_number "marker return 0"]" \
55
    "Breakpoint.*at.* file .*" ""
56
 
57
gdb_test "continue" "Breakpoint .* at .*" ""
58
 
59
# Access the "A" object.
60
 
61
gdb_test "print alpha" \
62
    "= {.*a1 = 100.*}" \
63
    "print alpha at marker return 0"
64
 
65
# Access the "B" object.
66
 
67
gdb_test "print beta" \
68
    "= {.*a1 = 200.*b1 = 201.*b2 = 202}" \
69
    "print beta at marker return 0"
70
 
71
# Access the "A" object through an "A *" pointer.
72
 
73
gdb_test_multiple "print * aap" "print * aap at marker return 0" {
74
    -re "= {.*a1 = 100.*}\r\n$gdb_prompt $" {
75
        # gcc 2.95.3 -gstabs+
76
        # gcc 3.3.2 -gdwarf-2
77
        # gcc 3.3.2 -gstabs+
78
        pass "print * aap at marker return 0"
79
    }
80
    -re "= {.*a1 = .*}\r\n$gdb_prompt $" {
81
        if { [test_compiler_info gcc-2-*] && [test_debug_format "DWARF 2"] } {
82
            # gcc 2.95.3 -gdwarf-2
83
            setup_kfail "gdb/1465" "*-*-*"
84
        }
85
        fail "print * aap at marker return 0"
86
    }
87
}
88
 
89
# Access the "B" object through a "B *" pointer.
90
 
91
gdb_test "print * bbp" \
92
    "= {.*a1 = 200.*b1 = 201.*b2 = 202}" \
93
    "print * bbp at marker return 0"
94
 
95
# Access the "B" object through an "A *" pointer.
96
# This should print using the "A" type.
97
 
98
gdb_test_multiple "print * abp" "print * abp at marker return 0, s-p-o off" {
99
    -re "= {.*a1 = 200.*b1 = .*b2 = .*}\r\n$gdb_prompt $" {
100
        # This would violate the documentation for "set print object off".
101
        fail "print * abp at marker return 0, s-p-o off"
102
    }
103
    -re "= {.*a1 = 200.*}\r\n$gdb_prompt $" {
104
        pass "print * abp at marker return 0, s-p-o off"
105
    }
106
}
107
 
108
# Access the "B" object through a "B *" pointer expression.
109
# This should print using the "B" type.
110
 
111
gdb_test "print * (B *) abp" \
112
    "= {.*a1 = 200.*b1 = 201.*b2 = 202}" \
113
    "print * (B *) abp at marker return 0"
114
 
115
# Printing the value of an object containing no data fields:
116
 
117
gdb_test "p e" "= \{\}" "print object with no data fields"
118
 
119
# Printing NULL pointers with "set print object on"
120
 
121
gdb_test_no_output "set print object on"
122
gdb_test "p acp" "= \\(C \\*\\) ${hex}"
123
gdb_test "p acp->c1" "\\(A \\*\\) 0x0"
124
gdb_test "p acp->c2" "\\(A \\*\\) ${hex}f"

powered by: WebSVN 2.1.0

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