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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.threads/] [tls-shared.exp] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2003, 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
# tls-shared.exp -- Expect script to test thread local storage in gdb, with
17
# shared libraries.
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
set testfile tls-main
24
set libfile tls-shared
25
set srcfile ${testfile}.c
26
set binfile ${objdir}/${subdir}/${testfile}
27
 
28
remote_exec build "rm -f ${binfile}"
29
 
30
# get the value of gcc_compiled
31
if [get_compiler_info ${binfile}] {
32
    return -1
33
}
34
 
35
if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
36
    return -1
37
}
38
 
39
# Build the shared libraries this test case needs.
40
#
41
 
42
if {$gcc_compiled == 0} {
43
    if [istarget "hppa*-hp-hpux*"] then {
44
        set additional_flags "additional_flags=+z"
45
    } elseif { [istarget "mips-sgi-irix*"] } {
46
        # Disable SGI compiler's implicit -Dsgi
47
        set additional_flags "additional_flags=-Usgi"
48
    } else {
49
        # don't know what the compiler is...
50
        set additional_flags ""
51
    }
52
} else {
53
    if { ([istarget "powerpc*-*-aix*"]
54
    || [istarget "rs6000*-*-aix*"]) } {
55
        set additional_flags ""
56
    } else {
57
        set additional_flags "additional_flags=-fpic"
58
    }
59
}
60
 
61
set additional_flags "$additional_flags -shared"
62
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.so" executable [list debug $additional_flags "incdir=${objdir}"]] != ""} {
63
    return -1
64
}
65
 
66
if { ($gcc_compiled
67
&&  ([istarget "powerpc*-*-aix*"]
68
|| [istarget "rs6000*-*-aix*"] )) } {
69
    set additional_flags "additional_flags=-L${objdir}/${subdir}"
70
} elseif { [istarget "mips-sgi-irix*"] } {
71
    set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
72
} else {
73
    set additional_flags ""
74
}
75
 
76
if {[gdb_compile_pthreads "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.so" "${binfile}" executable [list debug $additional_flags]] != ""} {
77
    return -1
78
}
79
 
80
 
81
gdb_exit
82
gdb_start
83
gdb_reinitialize_dir $srcdir/$subdir
84
gdb_load ${binfile}
85
 
86
if ![runto_main] then {
87
    fail "Can't run to main"
88
    return 0
89
}
90
 
91
gdb_test "print i_tls" "2" "print thread local storage variable"
92
 
93
gdb_test "ptype i_tls" "int" "ptype of thread local storage variable"
94
 
95
gdb_test "info address i_tls" \
96
        "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the thread-local storage for .*tls-main.." \
97
        "print storage info for thread local storage variable"
98
 
99
set line_number [gdb_get_line_number "break here to check result"]
100
 
101
gdb_test "break $line_number" \
102
        "Breakpoint.*at.*file.*tls-main.c.*line ${line_number}." \
103
        "break at and of main"
104
gdb_test "continue" \
105
        "main .* at .*:.*return 0.*break here to check result.*" \
106
        "continue to break"
107
# This is more of a gcc/glibc test, really.
108
#
109
gdb_test "print result" "3" "print result"
110
 
111
 

powered by: WebSVN 2.1.0

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