diff options
author | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
commit | c906108c21474dfb4ed285bcc0ac6fe02cd400cc (patch) | |
tree | a0015aa5cedc19ccbab307251353a41722a3ae13 /gdb/testsuite/gdb.base/so-indr-cl.exp | |
parent | cd946cff9ede3f30935803403f06f6ed30cad136 (diff) | |
download | gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.zip gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.gz gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.bz2 |
Initial creation of sourceware repositorygdb-4_18-branchpoint
Diffstat (limited to 'gdb/testsuite/gdb.base/so-indr-cl.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/so-indr-cl.exp | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/so-indr-cl.exp b/gdb/testsuite/gdb.base/so-indr-cl.exp new file mode 100644 index 0000000..e37878e --- /dev/null +++ b/gdb/testsuite/gdb.base/so-indr-cl.exp @@ -0,0 +1,146 @@ +# Copyright (C) 1997, 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +if $tracelevel then { + strace $tracelevel + } + +set prms_id 0 +set bug_id 0 + +# are we on a target board +if ![isnative] then { + return +} + +# This test is presently only valid on HP-UX, since it requires +# that we use HP-UX-specific compiler & linker options to build +# the testcase. +# +setup_xfail "*-*-*" +clear_xfail "hppa*-*-*hpux*" + +set libfile "solib" +set testfile "so-indr-cl" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +# Build the shared libraries this test case needs. +# +#cd ${subdir} +#remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o" + + +if {$gcc_compiled == 0} { + if [istarget "hppa*-hp-hpux*"] then { + set additional_flags "additional_flags=+z" + } else { + # don't know what the compiler is... + set additional_flags "" + } +} else { + set additional_flags "additional_flags=-fpic" +} +if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${objdir}/${subdir}/${libfile}1.o" object [list debug $additional_flags]] != ""} { + perror "Couldn't compile ${libfile}1.c" + return -1 +} + +if [istarget "hppa*-hp-hpux*"] then { + remote_exec build "ld -b ${objdir}/${subdir}/${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl" +} else { + set additional_flags "additional_flags=-shared" + gdb_compile "${objdir}/${subdir}/${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags] +} + +# Build the test case +#remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" + + +if {$gcc_compiled == 0} { + if [istarget "hppa*-hp-hpux*"] then { + set additional_flags "additional_flags=-Ae" + } else { + # don't know what the compiler is, hope for the best, maybe it's ANSI... + set additional_flags "" + } +} else { + set additional_flags "" +} +if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { + perror "Couldn't build ${binfile}" + return -1 +} + +#cd .. + +# Start with a fresh gdb + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# This program implicitly loads SOM shared libraries. We wish to test +# whether a user can set breakpoints in a shlib before running the +# program, where the program doesn't directly call the shlib, but +# indirectly does via passing its address to another function. +# +# ??rehrauer: Currently, this doesn't work, but we do catch the case +# and explicitly disallow it. The reason it fails appears to be that +# +# [1] gdb consults only the linker symbol table in this scenario, and +# [2] For a shlib function that is only indirectly called from the +# main a.out, there is in the linker symbol table a stub whose +# address is negative. Possibly this is to be interpreted as +# an index into the DLT?? +# +send_gdb "break solib_main\n" +gdb_expect { + -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\ + {pass "break on indirect solib call before running"} + -re "$gdb_prompt $"\ + {fail "break on indirect solib call before running"} + timeout {fail "(timeout) break on indirect solib call before running"} +} + +# However, if we do run to the program's main, we then ought to be +# able to set a breakpoint on the indirectly called function. (Apparently, +# once the inferior is running, gdb consults the debug info rather than +# the linker symbol table, and is able to find the correct address.) +# +if ![runto_main] then { fail "indirect solib call tests suppressed" } + +# Verify that we can step over the first shlib call. +# +send_gdb "break solib_main\n" +gdb_expect { + -re ".*\[Bb\]reakpoint \[0-9\]* at 0x\[0-9a-fA-F\]*: file.*${libfile}1.c.*$gdb_prompt $"\ + {pass "break on indirect solib call after running"} + -re "$gdb_prompt $"\ + {fail "break on indirect solib call after running"} + timeout {fail "(timeout) break on indirect solib call after running"} +} + +gdb_exit +return 0 |