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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.base/] [so-indr-cl.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
#   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
#
36
if {! [istarget "hppa*-*-*hpux*"] } {
37
    return
38
}
39
 
40
set libfile "solib"
41
set testfile "so-indr-cl"
42
set srcfile ${testfile}.c
43
set binfile ${objdir}/${subdir}/${testfile}
44
 
45
if [get_compiler_info ${binfile}] {
46
    return -1
47
}
48
 
49
# Build the shared libraries this test case needs.
50
#
51
#cd ${subdir}
52
#remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o"
53
 
54
 
55
if {$hp_cc_compiler || $hp_aCC_compiler} {
56
    set additional_flags "additional_flags=+z"
57
} else {
58
    set additional_flags "additional_flags=-fpic"
59
}
60
if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${objdir}/${subdir}/${libfile}1.o" object [list debug $additional_flags]] != ""} {
61
    perror "Couldn't compile ${libfile}1.c"
62
    return -1
63
}
64
 
65
if [istarget "hppa*-hp-hpux*"] then {
66
    remote_exec build "ld -b ${objdir}/${subdir}/${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl"
67
} else {
68
    set additional_flags "additional_flags=-shared"
69
    gdb_compile "${objdir}/${subdir}/${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags]
70
}
71
 
72
# Build the test case
73
#remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}"
74
 
75
 
76
if {$hp_cc_compiler} {
77
    set additional_flags "additional_flags=-Ae"
78
} else {
79
    set additional_flags ""
80
}
81
if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
82
    perror "Couldn't build ${binfile}"
83
    return -1
84
}
85
 
86
#cd ..
87
 
88
# Start with a fresh gdb
89
 
90
gdb_exit
91
gdb_start
92
gdb_reinitialize_dir $srcdir/$subdir
93
gdb_load ${binfile}
94
 
95
# This program implicitly loads SOM shared libraries.  We wish to test
96
# whether a user can set breakpoints in a shlib before running the
97
# program, where the program doesn't directly call the shlib, but
98
# indirectly does via passing its address to another function.
99
#
100
# ??rehrauer: Currently, this doesn't work, but we do catch the case
101
# and explicitly disallow it.  The reason it fails appears to be that
102
#
103
#  [1] gdb consults only the linker symbol table in this scenario, and
104
#  [2] For a shlib function that is only indirectly called from the
105
#      main a.out, there is in the linker symbol table a stub whose
106
#      address is negative.  Possibly this is to be interpreted as
107
#      an index into the DLT??
108
#
109
send_gdb "break solib_main\n"
110
gdb_expect {
111
  -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\
112
          {pass "break on indirect solib call before running"}
113
  -re "Breakpoint.*deferred.*\\(\"solib_main\" was not found.*$gdb_prompt $"\
114
          {pass "break on indirect solib call before running 2"}
115
  -re "$gdb_prompt $"\
116
          {fail "break on indirect solib call before running"}
117
  timeout {fail "(timeout) break on indirect solib call before running"}
118
}
119
 
120
# However, if we do run to the program's main, we then ought to be
121
# able to set a breakpoint on the indirectly called function.  (Apparently,
122
# once the inferior is running, gdb consults the debug info rather than
123
# the linker symbol table, and is able to find the correct address.)
124
#
125
if ![runto_main] then { fail "indirect solib call tests suppressed" }
126
 
127
# Verify that we can step over the first shlib call.
128
#
129
send_gdb "break solib_main\n"
130
gdb_expect {
131
  -re ".*\[Bb\]reakpoint \[0-9\]* at 0x\[0-9a-fA-F\]*: file.*${libfile}1.c.*$gdb_prompt $"\
132
          {pass "break on indirect solib call after running"}
133
  -re "$gdb_prompt $"\
134
          {fail "break on indirect solib call after running"}
135
  timeout {fail "(timeout) break on indirect solib call after running"}
136
}
137
 
138
gdb_exit
139
return 0

powered by: WebSVN 2.1.0

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