OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [so-indr-cl.exp] - Diff between revs 107 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
#   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
#   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
# Please email any bugs, comments, and/or additions to this file to:
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# bug-gdb@prep.ai.mit.edu
if $tracelevel then {
if $tracelevel then {
        strace $tracelevel
        strace $tracelevel
        }
        }
set prms_id 0
set prms_id 0
set bug_id 0
set bug_id 0
# are we on a target board
# are we on a target board
if ![isnative] then {
if ![isnative] then {
    return
    return
}
}
# This test is presently only valid on HP-UX, since it requires
# This test is presently only valid on HP-UX, since it requires
# that we use HP-UX-specific compiler & linker options to build
# that we use HP-UX-specific compiler & linker options to build
# the testcase.
# the testcase.
#
#
if {! [istarget "hppa*-*-*hpux*"] } {
if {! [istarget "hppa*-*-*hpux*"] } {
    return
    return
}
}
set libfile "solib"
set libfile "solib"
set testfile "so-indr-cl"
set testfile "so-indr-cl"
set srcfile ${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile ${objdir}/${subdir}/${testfile}
if [get_compiler_info ${binfile}] {
if [get_compiler_info ${binfile}] {
    return -1
    return -1
}
}
# Build the shared libraries this test case needs.
# Build the shared libraries this test case needs.
#
#
#cd ${subdir}
#cd ${subdir}
#remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o"
#remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o"
if {$hp_cc_compiler || $hp_aCC_compiler} {
if {$hp_cc_compiler || $hp_aCC_compiler} {
    set additional_flags "additional_flags=+z"
    set additional_flags "additional_flags=+z"
} else {
} else {
    set additional_flags "additional_flags=-fpic"
    set additional_flags "additional_flags=-fpic"
}
}
if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${objdir}/${subdir}/${libfile}1.o" object [list debug $additional_flags]] != ""} {
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"
    perror "Couldn't compile ${libfile}1.c"
    return -1
    return -1
}
}
if [istarget "hppa*-hp-hpux*"] then {
if [istarget "hppa*-hp-hpux*"] then {
    remote_exec build "ld -b ${objdir}/${subdir}/${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl"
    remote_exec build "ld -b ${objdir}/${subdir}/${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl"
} else {
} else {
    set additional_flags "additional_flags=-shared"
    set additional_flags "additional_flags=-shared"
    gdb_compile "${objdir}/${subdir}/${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags]
    gdb_compile "${objdir}/${subdir}/${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags]
}
}
# Build the test case
# Build the test case
#remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}"
#remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}"
if {$hp_cc_compiler} {
if {$hp_cc_compiler} {
    set additional_flags "additional_flags=-Ae"
    set additional_flags "additional_flags=-Ae"
} else {
} else {
    set additional_flags ""
    set additional_flags ""
}
}
if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
    perror "Couldn't build ${binfile}"
    perror "Couldn't build ${binfile}"
    return -1
    return -1
}
}
#cd ..
#cd ..
# Start with a fresh gdb
# Start with a fresh gdb
gdb_exit
gdb_exit
gdb_start
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_load ${binfile}
# This program implicitly loads SOM shared libraries.  We wish to test
# This program implicitly loads SOM shared libraries.  We wish to test
# whether a user can set breakpoints in a shlib before running the
# whether a user can set breakpoints in a shlib before running the
# program, where the program doesn't directly call the shlib, but
# program, where the program doesn't directly call the shlib, but
# indirectly does via passing its address to another function.
# indirectly does via passing its address to another function.
#
#
# ??rehrauer: Currently, this doesn't work, but we do catch the case
# ??rehrauer: Currently, this doesn't work, but we do catch the case
# and explicitly disallow it.  The reason it fails appears to be that
# and explicitly disallow it.  The reason it fails appears to be that
#
#
#  [1] gdb consults only the linker symbol table in this scenario, and
#  [1] gdb consults only the linker symbol table in this scenario, and
#  [2] For a shlib function that is only indirectly called from the
#  [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
#      main a.out, there is in the linker symbol table a stub whose
#      address is negative.  Possibly this is to be interpreted as
#      address is negative.  Possibly this is to be interpreted as
#      an index into the DLT??
#      an index into the DLT??
#
#
send_gdb "break solib_main\n"
send_gdb "break solib_main\n"
gdb_expect {
gdb_expect {
  -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\
  -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\
          {pass "break on indirect solib call before running"}
          {pass "break on indirect solib call before running"}
  -re "Breakpoint.*deferred.*\\(\"solib_main\" was not found.*$gdb_prompt $"\
  -re "Breakpoint.*deferred.*\\(\"solib_main\" was not found.*$gdb_prompt $"\
          {pass "break on indirect solib call before running 2"}
          {pass "break on indirect solib call before running 2"}
  -re "$gdb_prompt $"\
  -re "$gdb_prompt $"\
          {fail "break on indirect solib call before running"}
          {fail "break on indirect solib call before running"}
  timeout {fail "(timeout) 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
# 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,
# able to set a breakpoint on the indirectly called function.  (Apparently,
# once the inferior is running, gdb consults the debug info rather than
# once the inferior is running, gdb consults the debug info rather than
# the linker symbol table, and is able to find the correct address.)
# the linker symbol table, and is able to find the correct address.)
#
#
if ![runto_main] then { fail "indirect solib call tests suppressed" }
if ![runto_main] then { fail "indirect solib call tests suppressed" }
# Verify that we can step over the first shlib call.
# Verify that we can step over the first shlib call.
#
#
send_gdb "break solib_main\n"
send_gdb "break solib_main\n"
gdb_expect {
gdb_expect {
  -re ".*\[Bb\]reakpoint \[0-9\]* at 0x\[0-9a-fA-F\]*: file.*${libfile}1.c.*$gdb_prompt $"\
  -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"}
          {pass "break on indirect solib call after running"}
  -re "$gdb_prompt $"\
  -re "$gdb_prompt $"\
          {fail "break on indirect solib call after running"}
          {fail "break on indirect solib call after running"}
  timeout {fail "(timeout) break on indirect solib call after running"}
  timeout {fail "(timeout) break on indirect solib call after running"}
}
}
gdb_exit
gdb_exit
return 0
return 0
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.