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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [prelink.exp] - Blame information for rev 321

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 2006, 2007, 2008 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
set prms_id 0
26
set bug_id 0
27
 
28
# are we on a target board
29
if ![isnative] then {
30
    return
31
}
32
 
33
if [get_compiler_info "ignored"] {
34
    return -1
35
}
36
 
37
if {$gcc_compiled == 0} {
38
    return -1
39
}
40
 
41
set testfile "prelink"
42
 
43
set libsrcfile ${testfile}-lib.c
44
set libfile ${objdir}/${subdir}/${testfile}.so
45
if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
46
    # If creating the shared library fails, maybe we don't have the right tools
47
    return -1
48
}
49
 
50
if {[catch "system \"prelink -qNR ${libfile}\""] != 0} {
51
    # Maybe we don't have prelink.
52
    return -1
53
}
54
 
55
set srcfile ${testfile}.c
56
set binfile ${objdir}/${subdir}/${testfile}t
57
if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}" "${binfile}" executable [list debug "additional_flags=-Wl,-rpath,${objdir}/${subdir}"]] != ""} {
58
    return -1;
59
}
60
 
61
set found 0
62
set coredir "${objdir}/${subdir}/coredir.[getpid]"
63
file mkdir $coredir
64
catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
65
 
66
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
67
    if [remote_file build exists $i] {
68
        remote_exec build "mv $i ${objdir}/${subdir}/prelink.core"
69
        set found 1
70
    }
71
}
72
# Check for "core.PID".
73
if { $found == 0 } {
74
    set names [glob -nocomplain -directory $coredir core.*]
75
    if {[llength $names] == 1} {
76
        set corefile [file join $coredir [lindex $names 0]]
77
        remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core"
78
        set found 1
79
    }
80
}
81
 
82
# Try to clean up after ourselves.
83
remote_file build delete [file join $coredir coremmap.data]
84
remote_exec build "rmdir $coredir"
85
 
86
if { $found == 0  } {
87
    warning "can't generate a core file - prelink tests suppressed - check ulimit -c"
88
    return 0
89
}
90
 
91
if {[catch "system \"prelink -uN ${libfile}\""] != 0} {
92
    untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
93
    return 0
94
}
95
catch "system \"prelink -qNR ${libfile}\""
96
 
97
# Start with a fresh gdb
98
 
99
gdb_exit
100
gdb_start
101
gdb_reinitialize_dir $srcdir/$subdir
102
gdb_load ${binfile}
103
 
104
set test "prelink"
105
global gdb_prompt
106
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
107
    -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
108
        pass "$test"
109
    }
110
}
111
 
112
gdb_exit
113
 
114
return 0
115
 

powered by: WebSVN 2.1.0

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