Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2004, 2007, 2008, 2009, 2010 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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
f3205b34 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
f3205b34 AF |
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. | |
e22f8b7c | 12 | # |
f3205b34 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
f3205b34 | 15 | |
f3205b34 AF |
16 | # Test stepping into and continuing on from a function in |
17 | # a shared library (PR gdb/1555, was PR shlib/1280, shlib/1237). | |
18 | # Tested on ppc-yellowdog-linux (Yellow Dog Linux 3.0 3.2.2-2a) | |
19 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
93f02886 DJ |
24 | if {[skip_shlib_tests]} { |
25 | return 0 | |
26 | } | |
27 | ||
f3205b34 AF |
28 | set testfile gdb1555-main |
29 | set libfile gdb1555 | |
30 | set srcfile ${testfile}.c | |
31 | set binfile ${objdir}/${subdir}/${testfile} | |
32 | ||
9af2e58d DJ |
33 | set libsrc "${srcdir}/${subdir}/${libfile}.c" |
34 | set libobj "${objdir}/${subdir}/${libfile}.so" | |
35 | set execsrc "${srcdir}/${subdir}/${srcfile}" | |
f3205b34 | 36 | |
9af2e58d | 37 | remote_exec build "rm -f ${binfile}" |
f3205b34 | 38 | |
9af2e58d DJ |
39 | # get the value of gcc_compiled |
40 | if [get_compiler_info ${binfile}] { | |
f3205b34 AF |
41 | return -1 |
42 | } | |
43 | ||
9af2e58d DJ |
44 | if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" |
45 | || [gdb_compile $execsrc ${binfile} executable \ | |
46 | [list debug shlib=${libobj}]] != "" } { | |
f3205b34 AF |
47 | return -1 |
48 | } | |
49 | ||
f3205b34 AF |
50 | gdb_exit |
51 | gdb_start | |
52 | gdb_reinitialize_dir $srcdir/$subdir | |
53 | gdb_load ${binfile} | |
93f02886 | 54 | gdb_load_shlibs $libobj |
f3205b34 AF |
55 | |
56 | if ![runto_main] then { | |
57 | fail "Can't run to main" | |
58 | return 0 | |
59 | } | |
60 | ||
61 | # PR/1555 (was shlib 1280) | |
62 | set name "Step into shared lib function" | |
63 | gdb_test_multiple "s" $name \ | |
64 | { | |
b9c34f67 | 65 | -re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $" { |
f3205b34 AF |
66 | pass $name |
67 | } | |
68 | -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { | |
69 | kfail "gdb/1555" $name | |
70 | } | |
71 | } | |
72 | ||
73 | # PR/1555 (was shlib 1237) | |
74 | set name "Next while in a shared lib function" | |
75 | gdb_test_multiple "n" $name \ | |
76 | { | |
b9c34f67 | 77 | -re "\[0-9\]+.*return a;.*$gdb_prompt $" { |
f3205b34 AF |
78 | pass $name |
79 | } | |
80 | -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { | |
81 | kfail "gdb/1555" $name | |
82 | } | |
83 | } | |
84 |