Commit | Line | Data |
---|---|---|
6aba47ca | 1 | # Copyright 2004, 2007 Free Software Foundation, Inc. |
f3205b34 AF |
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 | ||
93f02886 DJ |
28 | if {[skip_shlib_tests]} { |
29 | return 0 | |
30 | } | |
31 | ||
f3205b34 AF |
32 | set testfile gdb1555-main |
33 | set libfile gdb1555 | |
34 | set srcfile ${testfile}.c | |
35 | set binfile ${objdir}/${subdir}/${testfile} | |
36 | ||
9af2e58d DJ |
37 | set libsrc "${srcdir}/${subdir}/${libfile}.c" |
38 | set libobj "${objdir}/${subdir}/${libfile}.so" | |
39 | set execsrc "${srcdir}/${subdir}/${srcfile}" | |
f3205b34 | 40 | |
9af2e58d | 41 | remote_exec build "rm -f ${binfile}" |
f3205b34 | 42 | |
9af2e58d DJ |
43 | # get the value of gcc_compiled |
44 | if [get_compiler_info ${binfile}] { | |
f3205b34 AF |
45 | return -1 |
46 | } | |
47 | ||
9af2e58d DJ |
48 | if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" |
49 | || [gdb_compile $execsrc ${binfile} executable \ | |
50 | [list debug shlib=${libobj}]] != "" } { | |
f3205b34 AF |
51 | return -1 |
52 | } | |
53 | ||
f3205b34 AF |
54 | gdb_exit |
55 | gdb_start | |
56 | gdb_reinitialize_dir $srcdir/$subdir | |
57 | gdb_load ${binfile} | |
93f02886 | 58 | gdb_load_shlibs $libobj |
f3205b34 AF |
59 | |
60 | if ![runto_main] then { | |
61 | fail "Can't run to main" | |
62 | return 0 | |
63 | } | |
64 | ||
65 | # PR/1555 (was shlib 1280) | |
66 | set name "Step into shared lib function" | |
67 | gdb_test_multiple "s" $name \ | |
68 | { | |
69 | -re "hithere2 \\(\\) at.*${libfile}.c:25\r\n25.*a = 21;.*$gdb_prompt $" { | |
70 | pass $name | |
71 | } | |
72 | -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { | |
73 | kfail "gdb/1555" $name | |
74 | } | |
75 | } | |
76 | ||
77 | # PR/1555 (was shlib 1237) | |
78 | set name "Next while in a shared lib function" | |
79 | gdb_test_multiple "n" $name \ | |
80 | { | |
81 | -re "26.*return a;.*$gdb_prompt $" { | |
82 | pass $name | |
83 | } | |
84 | -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { | |
85 | kfail "gdb/1555" $name | |
86 | } | |
87 | } | |
88 |