Commit | Line | Data |
---|---|---|
f3205b34 AF |
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 | remote_exec build "rm -f ${binfile}" | |
34 | ||
35 | # get the value of gcc_compiled | |
36 | if [get_compiler_info ${binfile}] { | |
37 | return -1 | |
38 | } | |
39 | ||
40 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } { | |
41 | return -1 | |
42 | } | |
43 | ||
44 | # Build the shared libraries this test case needs. | |
45 | # | |
46 | ||
47 | if {$gcc_compiled == 0} { | |
48 | if [istarget "hppa*-hp-hpux*"] then { | |
49 | set additional_flags "additional_flags=+z" | |
50 | } elseif { [istarget "mips-sgi-irix*"] } { | |
51 | # Disable SGI compiler's implicit -Dsgi | |
52 | set additional_flags "additional_flags=-Usgi" | |
53 | } else { | |
54 | # don't know what the compiler is... | |
55 | set additional_flags "" | |
56 | } | |
57 | } else { | |
58 | if { ([istarget "powerpc*-*-aix*"] | |
59 | || [istarget "rs6000*-*-aix*"]) } { | |
60 | set additional_flags "" | |
61 | } else { | |
62 | set additional_flags "additional_flags=-fpic" | |
63 | } | |
64 | } | |
65 | ||
66 | set additional_flags "$additional_flags -shared" | |
67 | if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.so" executable [list debug $additional_flags "incdir=${objdir}"]] != ""} { | |
68 | return -1 | |
69 | } | |
70 | ||
71 | if { ($gcc_compiled | |
72 | && ([istarget "powerpc*-*-aix*"] | |
73 | || [istarget "rs6000*-*-aix*"] )) } { | |
74 | set additional_flags "additional_flags=-L${objdir}/${subdir}" | |
75 | } elseif { [istarget "mips-sgi-irix*"] } { | |
76 | set additional_flags "additional_flags=-rpath ${objdir}/${subdir}" | |
77 | } else { | |
78 | set additional_flags "" | |
79 | } | |
80 | ||
81 | if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.so" "${binfile}" executable [list debug $additional_flags]] != ""} { | |
82 | return -1 | |
83 | } | |
84 | ||
85 | ||
86 | gdb_exit | |
87 | gdb_start | |
88 | gdb_reinitialize_dir $srcdir/$subdir | |
89 | gdb_load ${binfile} | |
90 | ||
91 | if ![runto_main] then { | |
92 | fail "Can't run to main" | |
93 | return 0 | |
94 | } | |
95 | ||
96 | # PR/1555 (was shlib 1280) | |
97 | set name "Step into shared lib function" | |
98 | gdb_test_multiple "s" $name \ | |
99 | { | |
100 | -re "hithere2 \\(\\) at.*${libfile}.c:25\r\n25.*a = 21;.*$gdb_prompt $" { | |
101 | pass $name | |
102 | } | |
103 | -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { | |
104 | kfail "gdb/1555" $name | |
105 | } | |
106 | } | |
107 | ||
108 | # PR/1555 (was shlib 1237) | |
109 | set name "Next while in a shared lib function" | |
110 | gdb_test_multiple "n" $name \ | |
111 | { | |
112 | -re "26.*return a;.*$gdb_prompt $" { | |
113 | pass $name | |
114 | } | |
115 | -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { | |
116 | kfail "gdb/1555" $name | |
117 | } | |
118 | } | |
119 |