xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/gdb1555.exp (revision d90047b5d07facf36e6c01dcc0bded8997ce9cc2)
1# Copyright 2004-2017 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 3 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, see <http://www.gnu.org/licenses/>.  */
15
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
20if {[skip_shlib_tests]} {
21    return 0
22}
23
24standard_testfile gdb1555-main.c gdb1555.c
25
26set libfile gdb1555
27set libsrc "${srcdir}/${subdir}/${libfile}.c"
28set libobj [standard_output_file ${libfile}.so]
29set execsrc "${srcdir}/${subdir}/${srcfile}"
30
31remote_exec build "rm -f ${binfile}"
32
33# get the value of gcc_compiled
34if [get_compiler_info] {
35    return -1
36}
37
38if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
39     || [gdb_compile $execsrc ${binfile} executable \
40	     [list debug shlib=${libobj}]] != "" } {
41    return -1
42}
43
44clean_restart ${binfile}
45gdb_load_shlib $libobj
46
47if ![runto_main] then {
48    fail "can't run to main"
49    return 0
50}
51
52# PR/1555 (was shlib 1280)
53set name "Step into shared lib function"
54gdb_test_multiple "s" $name \
55{
56    -re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $"  {
57	pass $name
58    }
59    -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" {
60	kfail "gdb/1555" $name
61    }
62}
63
64# PR/1555 (was shlib 1237)
65set name "Next while in a shared lib function"
66gdb_test_multiple "n" $name \
67{
68    -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
69	pass $name
70    }
71    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" {
72	kfail "gdb/1555" $name
73    }
74}
75
76