OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [testsuite/] [gdb.base/] [prelink.exp] - Diff between revs 157 and 223

Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
# Copyright 2006, 2007, 2008 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 3 of the License, or
# the Free Software Foundation; either version 3 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, see .
# along with this program.  If not, see .
# 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@gnu.org
# bug-gdb@gnu.org
# This file was written by Alexandre Oliva 
# This file was written by Alexandre Oliva 
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
}
}
if [get_compiler_info "ignored"] {
if [get_compiler_info "ignored"] {
    return -1
    return -1
}
}
if {$gcc_compiled == 0} {
if {$gcc_compiled == 0} {
    return -1
    return -1
}
}
set testfile "prelink"
set testfile "prelink"
set libsrcfile ${testfile}-lib.c
set libsrcfile ${testfile}-lib.c
set libfile ${objdir}/${subdir}/${testfile}.so
set libfile ${objdir}/${subdir}/${testfile}.so
if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
    # If creating the shared library fails, maybe we don't have the right tools
    # If creating the shared library fails, maybe we don't have the right tools
    return -1
    return -1
}
}
if {[catch "system \"prelink -qNR ${libfile}\""] != 0} {
if {[catch "system \"prelink -qNR ${libfile}\""] != 0} {
    # Maybe we don't have prelink.
    # Maybe we don't have prelink.
    return -1
    return -1
}
}
set srcfile ${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}t
set binfile ${objdir}/${subdir}/${testfile}t
if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}" "${binfile}" executable [list debug "additional_flags=-Wl,-rpath,${objdir}/${subdir}"]] != ""} {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}" "${binfile}" executable [list debug "additional_flags=-Wl,-rpath,${objdir}/${subdir}"]] != ""} {
    return -1;
    return -1;
}
}
set found 0
set found 0
set coredir "${objdir}/${subdir}/coredir.[getpid]"
set coredir "${objdir}/${subdir}/coredir.[getpid]"
file mkdir $coredir
file mkdir $coredir
catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
    if [remote_file build exists $i] {
    if [remote_file build exists $i] {
        remote_exec build "mv $i ${objdir}/${subdir}/prelink.core"
        remote_exec build "mv $i ${objdir}/${subdir}/prelink.core"
        set found 1
        set found 1
    }
    }
}
}
# Check for "core.PID".
# Check for "core.PID".
if { $found == 0 } {
if { $found == 0 } {
    set names [glob -nocomplain -directory $coredir core.*]
    set names [glob -nocomplain -directory $coredir core.*]
    if {[llength $names] == 1} {
    if {[llength $names] == 1} {
        set corefile [file join $coredir [lindex $names 0]]
        set corefile [file join $coredir [lindex $names 0]]
        remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core"
        remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core"
        set found 1
        set found 1
    }
    }
}
}
# Try to clean up after ourselves.
# Try to clean up after ourselves.
remote_file build delete [file join $coredir coremmap.data]
remote_file build delete [file join $coredir coremmap.data]
remote_exec build "rmdir $coredir"
remote_exec build "rmdir $coredir"
if { $found == 0  } {
if { $found == 0  } {
    warning "can't generate a core file - prelink tests suppressed - check ulimit -c"
    warning "can't generate a core file - prelink tests suppressed - check ulimit -c"
    return 0
    return 0
}
}
if {[catch "system \"prelink -uN ${libfile}\""] != 0} {
if {[catch "system \"prelink -uN ${libfile}\""] != 0} {
    untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
    untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
    return 0
    return 0
}
}
catch "system \"prelink -qNR ${libfile}\""
catch "system \"prelink -qNR ${libfile}\""
# 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}
set test "prelink"
set test "prelink"
global gdb_prompt
global gdb_prompt
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
    -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
    -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
        pass "$test"
        pass "$test"
    }
    }
}
}
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.