* gdb.base/gdb1555.exp: Use gdb_compile_shlib. Skip if not
[external/binutils.git] / gdb / testsuite / gdb.base / gdb1555.exp
1 # Copyright 2004 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 # Test stepping into and continuing on from a function in
21 # a shared library (PR gdb/1555, was PR shlib/1280, shlib/1237).
22 # Tested on ppc-yellowdog-linux (Yellow Dog Linux 3.0 3.2.2-2a)
23
24 if $tracelevel then {
25     strace $tracelevel
26 }
27
28 set testfile gdb1555-main
29 set libfile gdb1555
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32
33 set libsrc "${srcdir}/${subdir}/${libfile}.c"
34 set libobj "${objdir}/${subdir}/${libfile}.so"
35 set execsrc "${srcdir}/${subdir}/${srcfile}"
36
37 remote_exec build "rm -f ${binfile}"
38
39 # Are we on a target board?  No support for downloading shared libraries
40 # to a target yet.
41 if ![isnative] then {
42     return 0
43 }
44
45 # get the value of gcc_compiled
46 if [get_compiler_info ${binfile}] {
47     return -1
48 }
49
50 if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
51      || [gdb_compile $execsrc ${binfile} executable \
52              [list debug shlib=${libobj}]] != "" } {
53     return -1
54 }
55
56 gdb_exit
57 gdb_start
58 gdb_reinitialize_dir $srcdir/$subdir
59 gdb_load ${binfile}
60
61 if ![runto_main] then {
62     fail "Can't run to main"
63     return 0
64 }
65
66 # PR/1555 (was shlib 1280)
67 set name "Step into shared lib function"
68 gdb_test_multiple "s" $name \
69 {
70     -re "hithere2 \\(\\) at.*${libfile}.c:25\r\n25.*a = 21;.*$gdb_prompt $"  {
71         pass $name
72     }
73     -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { 
74         kfail "gdb/1555" $name 
75     }
76 }
77
78 # PR/1555 (was shlib 1237)
79 set name "Next while in a shared lib function"
80 gdb_test_multiple "n" $name \
81 {
82     -re "26.*return a;.*$gdb_prompt $" {
83         pass $name
84     }
85     -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { 
86         kfail "gdb/1555" $name 
87     }
88 }
89