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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [gdb.base/] [so-impl-ld.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Copyright 1997, 1998, 1999, 2000 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
if $tracelevel then {
21
        strace $tracelevel
22
        }
23
 
24
set prms_id 0
25
set bug_id 0
26
 
27
# are we on a target board
28
if ![isnative] then {
29
    return
30
}
31
 
32
# This test is presently only valid on HP-UX, since it requires
33
# that we use HP-UX-specific compiler & linker options to build
34
# the testcase.
35
# Actually this test works on solaris, and linux too.
36
 
37
if {! ([istarget "hppa*-*-*hpux*"]
38
       || [istarget "sparc-sun-solaris*"]
39
       || [istarget " *-*-linux-gnu*"]) } {
40
         return
41
}
42
 
43
set libfile "solib"
44
set testfile "so-impl-ld"
45
set srcfile ${testfile}.c
46
set binfile ${objdir}/${subdir}/${testfile}
47
 
48
if [get_compiler_info ${binfile}] {
49
    return -1
50
}
51
 
52
# Build the shared libraries this test case needs.
53
#
54
#cd ${subdir}
55
#remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o"
56
 
57
 
58
if {$gcc_compiled == 0} {
59
    if [istarget "hppa*-hp-hpux*"] then {
60
        set additional_flags "additional_flags=+z"
61
    } else {
62
        # don't know that the compiler is, hope for the best...
63
        set additional_flags ""
64
    }
65
} else {
66
    set additional_flags "additional_flags=-fpic"
67
}
68
 
69
if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${libfile}1.o" object [list debug $additional_flags]] != ""} {
70
    perror "Couldn't compile ${libfile}1.c"
71
    return -1
72
}
73
 
74
if [istarget "hppa*-hp-hpux*"] then {
75
    remote_exec build "ld -b ${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl"
76
} else {
77
    set additional_flags "additional_flags=-shared"
78
    gdb_compile "${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags]
79
}
80
 
81
# Build the test case
82
#remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}"
83
 
84
 
85
if {$hp_cc_compiler} {
86
    set additional_flags "additional_flags=-Ae"
87
} else {
88
    set additional_flags ""
89
}
90
 
91
if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
92
    perror "Couldn't build ${binfile}"
93
    return -1
94
}
95
#cd ..
96
 
97
# Start with a fresh gdb
98
 
99
gdb_exit
100
gdb_start
101
gdb_reinitialize_dir $srcdir/$subdir
102
gdb_load ${binfile}
103
 
104
# This program implicitly loads SOM shared libraries.
105
#
106
if ![runto_main] then { fail "implicit solibs tests suppressed" }
107
 
108
# Verify that we can step over the first shlib call.
109
#
110
send_gdb "next\n"
111
gdb_expect {
112
  -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\
113
          {pass "step over solib call"}
114
  -re "$gdb_prompt $"\
115
          {fail "step over solib call"}
116
  timeout {fail "(timeout) step over solib call"}
117
}
118
 
119
# Verify that we can step into the second shlib call.
120
#
121
send_gdb "step\n"
122
gdb_expect {
123
  -re "solib_main .arg=10000. at.*${libfile}1.c:17.*$gdb_prompt $"\
124
          {pass "step into solib call"}
125
  -re "$gdb_prompt $"\
126
          {fail "step into solib call"}
127
  timeout {fail "(timeout) step into solib call"}
128
}
129
 
130
# Verify that we can step within the shlib call.
131
#
132
send_gdb "next\n"
133
gdb_expect {
134
  -re "18\[ \t\]*\}.*$gdb_prompt $"\
135
          {pass "step in solib call"}
136
  -re "$gdb_prompt $"\
137
          {fail "step in solib call"}
138
  timeout {fail "(timeout) step in solib call"}
139
}
140
 
141
# Verify that we can step out of the shlib call, and back out into
142
# the caller.
143
#
144
send_gdb "next\n"
145
gdb_expect {
146
    -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
147
        # we haven't left the callee yet, so do another next
148
        send_gdb "next\n"
149
        gdb_expect {
150
            -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
151
                {pass "step out of solib call"}
152
            -re "$gdb_prompt $"\
153
                {fail "step out of solib call"}
154
            timeout {fail "(timeout) step out of solib call"}
155
        }
156
    }
157
 
158
    -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
159
        {pass "step out of solib call"}
160
    -re "$gdb_prompt $"\
161
        {fail "step out of solib call"}
162
    timeout {fail "(timeout) step out of solib call"}
163
}
164
 
165
gdb_exit
166
return 0
167
 
168
 
169
 
170
 
171
 
172
 

powered by: WebSVN 2.1.0

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