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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.cp/] [shadow.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 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 that when multiple variables have the same
17
# name the one from the correct scope is printed.
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
 
24
set testfile shadow
25
set srcfile ${testfile}.cc
26
set binfile ${objdir}/${subdir}/${testfile}
27
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
28
    untested "Couldn't compile test program"
29
    return -1
30
}
31
 
32
if [get_compiler_info ${binfile}] {
33
    return -1
34
}
35
 
36
# Get things started.
37
 
38
gdb_exit
39
gdb_start
40
gdb_reinitialize_dir $srcdir/$subdir
41
gdb_load ${binfile}
42
 
43
if ![runto_main] then {
44
    perror "couldn't run to breakpoint main"
45
    continue
46
}
47
 
48
############################################
49
# Test printing of class variable is not shadowed
50
# by global variable
51
 
52
gdb_breakpoint [gdb_get_line_number "marker1"]
53
gdb_continue_to_breakpoint "marker1"
54
 
55
gdb_test "print x" "= 33" "Print class x shadowing global x"
56
 
57
 
58
############################################
59
# Test printing local variable is not shadowed
60
# by class variable
61
 
62
gdb_breakpoint [gdb_get_line_number "marker2"]
63
gdb_continue_to_breakpoint "marker2"
64
 
65
gdb_test "print x" "= 44" "Print local x shadowing class x"
66
 
67
############################################
68
# Test inner scope x is printed not outer scope
69
 
70
gdb_breakpoint [gdb_get_line_number "marker3"]
71
gdb_continue_to_breakpoint "marker3"
72
 
73
gdb_test "print x" "= 55" "Print inner scope x"
74
 
75
############################################
76
# Test printing local variable is not shadowed
77
# by namespace variable
78
 
79
gdb_breakpoint [gdb_get_line_number "marker4"]
80
gdb_continue_to_breakpoint "marker4"
81
 
82
gdb_test "print x" "= 55" "Print local x not namespace x"
83
 
84
############################################
85
# Test imported namespace element is printed
86
 
87
gdb_breakpoint [gdb_get_line_number "marker5"]
88
gdb_continue_to_breakpoint "marker5"
89
 
90
if { [test_compiler_info {gcc-[0-3]-*}] ||
91
     [test_compiler_info {gcc-4-[0-3]-*}]} {
92
    setup_xfail *-*-*
93
}
94
 
95
gdb_test "print x" "= 11" "Print imported namespace x"

powered by: WebSVN 2.1.0

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