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

Subversion Repositories openrisc_2011-10-31

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2009, 2010 Free Software Foundation, Inc.
2
# This program is free software; you can redistribute it and/or modify
3
# it under the terms of the GNU General Public License as published by
4
# the Free Software Foundation; either version 3 of the License, or
5
# (at your option) any later version.
6
#
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
# GNU General Public License for more details.
11
#
12
# You should have received a copy of the GNU General Public License
13
# along with this program.  If not, see .
14
#
15
# Contributed by Paul Pluzhnikov 
16
#
17
 
18
# This test case verifies that if a display is active on a variable
19
# which belongs in a shared library, and that shared library is
20
# reloaded (e.g. due to re-execution of the program), GDB will continue
21
# to display it (gdb-6.8 crashed under this scenario).
22
 
23
# Also test that a display of variable which is currently present in
24
# a shared library, but disappears before re-run, doesn't cause GDB
25
# difficulties, and that it continues to display other variables.
26
 
27
# Finally, test that displays which refer to main executable
28
# (and thus aren't affected by shared library unloading) are not
29
# disabled prematurely.
30
 
31
if { [skip_shlib_tests] || [is_remote target] } {
32
    return 0
33
}
34
 
35
# Library file.
36
set libname "solib-display-lib"
37
set srcfile_lib ${srcdir}/${subdir}/${libname}.c
38
set binfile_lib ${objdir}/${subdir}/${libname}.so
39
set lib_flags {}
40
# Binary file.
41
set testfile "solib-display-main"
42
set srcfile ${srcdir}/${subdir}/${testfile}.c
43
set executable ${testfile}
44
set binfile ${objdir}/${subdir}/${executable}
45
set bin_flags [list debug shlib=${binfile_lib}]
46
 
47
if [get_compiler_info ${binfile}] {
48
    return -1
49
}
50
 
51
set save_pf_prefix $pf_prefix
52
# SEP must be last for the possible `unsupported' error path.
53
foreach libsepdebug {NO IN SEP} {
54
 
55
    set pf_prefix $save_pf_prefix
56
    lappend pf_prefix "$libsepdebug:"
57
 
58
    set sep_lib_flags $lib_flags
59
    if {$libsepdebug != "NO"} {
60
        lappend sep_lib_flags {debug}
61
    }
62
    if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $sep_lib_flags] != ""
63
         || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
64
      untested "Could not compile $binfile_lib or $binfile."
65
      return -1
66
    }
67
 
68
    if {$libsepdebug == "SEP"} {
69
        if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
70
            unsupported "Could not split debug of $binfile_lib."
71
            return
72
        } else {
73
            pass "split solib"
74
        }
75
    }
76
 
77
    clean_restart $executable
78
 
79
    if ![runto_main] then {
80
      fail "Can't run to main"
81
      return 0
82
    }
83
 
84
    gdb_test "display a_global" "1: a_global = 41"
85
    gdb_test "display b_global" "2: b_global = 42"
86
    gdb_test "display c_global" "3: c_global = 43"
87
 
88
    if { [gdb_start_cmd] < 0 } {
89
        fail "Can't run to main (2)"
90
        continue
91
    }
92
 
93
    gdb_test "" "3: c_global = 43\\r\\n2: b_global = 42\\r\\n1: a_global = 41" "after rerun"
94
 
95
    # Now rebuild the library without b_global
96
    if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} \
97
              "$sep_lib_flags additional_flags=-DNO_B_GLOBAL"] != ""} {
98
        fail "Can't rebuild $binfile_lib"
99
    }
100
 
101
    if {$libsepdebug == "SEP"} {
102
        set test "split solib second time"
103
        if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
104
            fail $test
105
            continue
106
        } else {
107
            pass $test
108
        }
109
    }
110
 
111
    if { [gdb_start_cmd] < 0 } {
112
        fail "Can't run to main (3)"
113
        continue
114
    }
115
 
116
    gdb_test "" "3: c_global = 43\\r\\nwarning: .*b_global.*\\r\\n1: a_global = 41" "after rerun (2)"
117
 
118
    # Now verify that displays which are not in the shared library
119
    # are not cleared permaturely.
120
 
121
    gdb_test "break [gdb_get_line_number "break here" ${testfile}.c]" \
122
            ".*Breakpoint.* at .*"
123
 
124
    gdb_test "continue"
125
    gdb_test "display main_global" "4: main_global = 44"
126
    gdb_test "display a_local" "5: a_local = 45"
127
    gdb_test "display a_static" "6: a_static = 46"
128
 
129
    if { [gdb_start_cmd] < 0 } {
130
        fail "Can't run to main (4)"
131
        continue
132
    }
133
 
134
    gdb_test "" "6: a_static = 46\\r\\n4: main_global = 44\\r\\n.*"
135
    gdb_test "break [gdb_get_line_number "break here" ${testfile}.c]" \
136
            ".*Breakpoint.* at .*"
137
    gdb_test "continue" "6: a_static = 46\\r\\n5: a_local = 45\\r\\n4: main_global = 44\\r\\n.*"
138
}
139
set pf_prefix $save_pf_prefix

powered by: WebSVN 2.1.0

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