* lib/gdb.exp (gdb_compile): Add support for Windows DLLs.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / so-impl-ld.exp
1 # Copyright 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 if $tracelevel then {
19 strace $tracelevel
20 }
21
22 set prms_id 0
23 set bug_id 0
24
25 if {[skip_shlib_tests]} {
26 return 0
27 }
28
29 set testfile "so-impl-ld"
30 set libfile "solib1"
31 set srcfile $srcdir/$subdir/$testfile.c
32 set libsrc $srcdir/$subdir/$libfile.c
33 set binfile $objdir/$subdir/$testfile
34 set lib_sl $objdir/$subdir/$libfile.sl
35
36 set lib_opts debug
37 set exec_opts [list debug shlib=$lib_sl]
38
39 if [get_compiler_info ${binfile}] {
40 return -1
41 }
42
43 if [get_compiler_info ${binfile}] {
44 return -1
45 }
46
47 if [test_compiler_info "hpcc-*"] {
48 lappend exec_opts "additional_flags=-Ae"
49 }
50
51 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
52 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
53 untested "Couldn't compile $libsrc or $srcfile."
54 return -1
55 }
56
57 # Start with a fresh gdb
58
59 gdb_exit
60 gdb_start
61 gdb_reinitialize_dir $srcdir/$subdir
62 gdb_load ${binfile}
63 gdb_load_shlibs $lib_sl
64
65 # This program implicitly loads SOM shared libraries.
66 #
67 if ![runto_main] then { fail "implicit solibs tests suppressed" }
68
69 # Verify that we can step over the first shlib call.
70 #
71 send_gdb "next\n"
72 gdb_expect {
73 -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\
74 {pass "step over solib call"}
75 -re "$gdb_prompt $"\
76 {fail "step over solib call"}
77 timeout {fail "(timeout) step over solib call"}
78 }
79
80 # Verify that we can step into the second shlib call.
81 #
82 send_gdb "step\n"
83 gdb_expect {
84 -re "solib_main .arg=10000. at.*${libfile}.c:17.*$gdb_prompt $"\
85 {pass "step into solib call"}
86 -re "$gdb_prompt $"\
87 {fail "step into solib call"}
88 timeout {fail "(timeout) step into solib call"}
89 }
90
91 # Verify that we can step within the shlib call.
92 #
93 send_gdb "next\n"
94 gdb_expect {
95 -re "18\[ \t\]*\}.*$gdb_prompt $"\
96 {pass "step in solib call"}
97 -re "$gdb_prompt $"\
98 {fail "step in solib call"}
99 timeout {fail "(timeout) step in solib call"}
100 }
101
102 # Verify that we can step out of the shlib call, and back out into
103 # the caller.
104 #
105 send_gdb "next\n"
106 gdb_expect {
107 -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
108 # we haven't left the callee yet, so do another next
109 send_gdb "next\n"
110 gdb_expect {
111 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
112 {pass "step out of solib call"}
113 -re "$gdb_prompt $"\
114 {fail "step out of solib call"}
115 timeout {fail "(timeout) step out of solib call"}
116 }
117 }
118
119 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
120 {pass "step out of solib call"}
121 -re "$gdb_prompt $"\
122 {fail "step out of solib call"}
123 timeout {fail "(timeout) step out of solib call"}
124 }
125
126 gdb_exit
127 return 0
128
129
130
131
132
133
This page took 0.034054 seconds and 5 git commands to generate.