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-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.base/] [prelink.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2006, 2007, 2008, 2009, 2010 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 .
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@gnu.org
18
 
19
# This file was written by Alexandre Oliva 
20
 
21
if $tracelevel then {
22
        strace $tracelevel
23
        }
24
 
25
 
26
if { ![isnative] || [is_remote host] || [skip_shlib_tests]} {
27
    return
28
}
29
 
30
if [get_compiler_info "ignored"] {
31
    return -1
32
}
33
 
34
if {$gcc_compiled == 0} {
35
    return -1
36
}
37
 
38
load_lib prelink-support.exp
39
 
40
set testfile "prelink"
41
 
42
set libsrcfile ${testfile}-lib.c
43
set libfile ${objdir}/${subdir}/${testfile}.so
44
 
45
# Use -soname so that the new library gets copied by build_executable_own_libs.
46
 
47
if { [gdb_compile_shlib "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" [list debug "additional_flags=-Wl,-soname,[file tail ${libfile}]"]] != ""} {
48
    # If creating the shared library fails, maybe we don't have the right tools
49
    return -1
50
}
51
 
52
set srcfile ${testfile}.c
53
set executable ${testfile}t
54
set binfile ${objdir}/${subdir}/${executable}
55
set prelink_args [build_executable_own_libs ${testfile}.exp $executable $srcfile [list debug "additional_flags=-Wl,${libfile},-rpath,[file dirname ${libfile}]"]]
56
if {$prelink_args == ""} {
57
    return -1
58
}
59
 
60
if ![prelink_yes $prelink_args] {
61
    # Maybe we don't have prelink.
62
    return -1
63
}
64
 
65
set found 0
66
set coredir "${objdir}/${subdir}/coredir.[getpid]"
67
file mkdir $coredir
68
catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
69
 
70
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
71
    if [remote_file build exists $i] {
72
        remote_exec build "mv $i ${objdir}/${subdir}/prelink.core"
73
        set found 1
74
    }
75
}
76
# Check for "core.PID".
77
if { $found == 0 } {
78
    set names [glob -nocomplain -directory $coredir core.*]
79
    if {[llength $names] == 1} {
80
        set corefile [file join $coredir [lindex $names 0]]
81
        remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core"
82
        set found 1
83
    }
84
}
85
 
86
# Try to clean up after ourselves.
87
remote_file build delete [file join $coredir coremmap.data]
88
remote_exec build "rmdir $coredir"
89
 
90
if { $found == 0  } {
91
    warning "can't generate a core file - prelink tests suppressed - check ulimit -c"
92
    return 0
93
}
94
 
95
# Relink $libfile to a different address.
96
if ![prelink_yes $prelink_args] {
97
    return -1
98
}
99
 
100
# Start with a fresh gdb
101
 
102
clean_restart $executable
103
 
104
# Print the "adjusting expectations" message.
105
gdb_test_no_output "set verbose on"
106
 
107
gdb_test "core-file $objdir/$subdir/prelink.core" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message"

powered by: WebSVN 2.1.0

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