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.opt/] [inline-locals.exp] - Blame information for rev 357

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

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2008, 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
set testfile "inline-locals"
17
set srcfile ${testfile}.c
18
set srcfile2 "inline-markers.c"
19
set fullsrcfile "${srcdir}/${subdir}/${srcfile}"
20
set fullsrcfile2 "${srcdir}/${subdir}/${srcfile2}"
21
set sources [list ${fullsrcfile} ${fullsrcfile2}]
22
set binfile ${objdir}/${subdir}/${testfile}
23
 
24
if  { [gdb_compile ${sources} ${binfile} \
25
           executable {debug optimize=-O2}] != "" } {
26
    untested inline-locals.exp
27
    return -1
28
}
29
 
30
gdb_exit
31
gdb_start
32
gdb_reinitialize_dir $srcdir/$subdir
33
gdb_load ${binfile}
34
 
35
runto_main
36
 
37
get_compiler_info $binfile
38
get_debug_format
39
if { [skip_inline_var_tests] } {
40
    untested inline-bt.exp
41
    return
42
}
43
 
44
set no_frames [skip_inline_frame_tests]
45
 
46
set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
47
gdb_breakpoint $srcfile2:$line1
48
 
49
gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (1)"
50
 
51
gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (2)"
52
 
53
if { ! $no_frames } {
54
    gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*main.*" \
55
        "backtrace from bar (2)"
56
    gdb_test "up" "#1  .*func1 .* at .*" "up from bar (2)"
57
    gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (2)"
58
    gdb_test "info locals" "array = {.*}" "info locals above bar (2)"
59
 
60
    set msg "info args above bar (2)"
61
    gdb_test_multiple "info args" $msg {
62
        -re "arg1 = $decimal\r\n$gdb_prompt $" {
63
            pass $msg
64
        }
65
        -re "arg1 = \r\n$gdb_prompt $" {
66
            # GCC 4.3 and later lose location information for arg1.  GCC 4.2 is OK.
67
            if { [test_compiler_info "gcc-4-3-*"]  || [test_compiler_info "gcc-4-4-*"]} {
68
                setup_xfail *-*-*
69
            }
70
            fail $msg
71
        }
72
    }
73
} else {
74
    gdb_test "up" "#1  .*main .* at .*" "up from bar (2)"
75
    gdb_test "info locals" ".*arg1 = 0.*" "info locals above bar (2)"
76
}
77
 
78
# Make sure that locals on the stack are found.  This is an array to
79
# prevent it from living in a register.
80
gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
81
 
82
if { ! $no_frames } {
83
    # Verify that we do not print out variables from the inlined
84
    # function's caller.
85
    gdb_test "print val" "No symbol \"val\" in current context\\." \
86
        "print out of scope local"
87
}
88
 
89
# Repeat the tests from a depth of two inlined functions, and with a
90
# more interesting value in the local array.
91
gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (3)"
92
if { ! $no_frames } {
93
    gdb_test "backtrace" "#0  bar.*#1  .*func1.*#2  .*func2.*#3  .*main.*" \
94
        "backtrace from bar (3)"
95
    gdb_test "up" "#1  .*func1 .* at .*" "up from bar (3)"
96
    gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (3)"
97
    gdb_test "info locals" "array = {.*}" "info locals above bar (3)"
98
 
99
    set msg "info args above bar (3)"
100
    gdb_test_multiple "info args" $msg {
101
        -re "arg1 = $decimal\r\n$gdb_prompt $" {
102
            pass $msg
103
        }
104
        -re "arg1 = \r\n$gdb_prompt $" {
105
            # GCC 4.3 and later lose location information for arg1.  GCC 4.2 is OK.
106
            if { [test_compiler_info "gcc-4-3-*"]  || [test_compiler_info "gcc-4-4-*"]} {
107
                setup_xfail *-*-*
108
            }
109
            fail $msg
110
        }
111
    }
112
} else {
113
    gdb_test "up" "#1  .*main .* at .*" "up from bar (3)"
114
    gdb_test "info locals" ".*arg1 = 1.*" "info locals above bar (3a)"
115
    gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
116
}
117
 
118
gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"

powered by: WebSVN 2.1.0

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