gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / so-impl-ld.exp
1 # Copyright 1997-2001, 2003, 2005, 2007-2012 Free Software Foundation,
2 # 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 3 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, see <http://www.gnu.org/licenses/>.
16
17
18 if {[skip_shlib_tests]} {
19 return 0
20 }
21
22 set testfile "so-impl-ld"
23 set libfile "solib1"
24 set srcfile $srcdir/$subdir/$testfile.c
25 set libsrc $srcdir/$subdir/$libfile.c
26 set binfile $objdir/$subdir/$testfile
27 set lib_sl $objdir/$subdir/$libfile.sl
28
29 set lib_opts debug
30 set exec_opts [list debug shlib=$lib_sl]
31
32 if [get_compiler_info] {
33 return -1
34 }
35
36 if [get_compiler_info] {
37 return -1
38 }
39
40 if [test_compiler_info "hpcc-*"] {
41 lappend exec_opts "additional_flags=-Ae"
42 }
43
44 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
45 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
46 untested "Couldn't compile $libsrc or $srcfile."
47 return -1
48 }
49
50 # Start with a fresh gdb
51
52 gdb_exit
53 gdb_start
54 gdb_reinitialize_dir $srcdir/$subdir
55 gdb_load ${binfile}
56 gdb_load_shlibs $lib_sl
57
58 # This program implicitly loads SOM shared libraries.
59 #
60 if ![runto_main] then { fail "implicit solibs tests suppressed" }
61
62 # Verify that we can step over the first shlib call.
63 #
64 gdb_test "next" "21\[ \t\]*result = solib_main .result.;" \
65 "step over solib call"
66
67 # Verify that we can step into the second shlib call.
68 #
69 gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:17.*" \
70 "step into solib call"
71
72 # Verify that we can step within the shlib call.
73 #
74 gdb_test "next" "18\[ \t\]*\}" "step in solib call"
75
76 # Verify that we can step out of the shlib call, and back out into
77 # the caller.
78 #
79 gdb_test_multiple "next" "step out of solib call" {
80 -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
81 gdb_test "next" \
82 "main .. at.*so-impl-ld.c:22.*" \
83 "step out of solib call"
84 }
85 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $" {
86 pass "step out of solib call"
87 }
88 }
89
90 gdb_exit
91 return 0
92
93
94
95
96
97
This page took 0.042845 seconds and 4 git commands to generate.