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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.hp/] [gdb.objdbg/] [objdbg01.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jlechner
# Test reading debug information from in object files.
2
 
3
if { [skip_hp_tests] } { continue }
4
 
5
if { ![istarget "hppa*-*-hpux*"] } {
6
    verbose "HPUX test ignored for non-hppa targets."
7
    return 0
8
}
9
 
10
set testfile "test"
11
set srcsubdir ${srcdir}/${subdir}/objdbg01
12
set toolssubdir ${srcdir}/${subdir}/tools
13
set objdbgdir ${objdir}/${subdir}/objdbg01
14
set binfile ${objdbgdir}/${testfile}
15
set symaddrfile ${toolssubdir}/symaddr
16
 
17
# Create and source the file that provides information about the compiler
18
# used to compile the test case.
19
if [get_compiler_info ${binfile}] {
20
    return -1
21
}
22
 
23
if {!$hp_aCC_compiler && !$hp_cc_compiler} {
24
  return 0
25
}
26
 
27
if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
28
    untested objdbg01.exp
29
    return -1
30
}
31
 
32
if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
33
    perror "Couldn't compile x1.cc"
34
    return -1
35
}
36
 
37
if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
38
    perror "Couldn't compile x2.cc"
39
    return -1
40
}
41
 
42
if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
43
    perror "Couldn't compile x3.cc"
44
    return -1
45
}
46
 
47
if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o ${objdbgdir}/x3.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
48
    perror "Couldn't compile ${binfile}0"
49
    return -1
50
}
51
 
52
if {[gdb_compile "${objdbgdir}/x3.o ${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
53
    perror "Couldn't compile ${binfile}1"
54
    return -1
55
}
56
 
57
# Test two executables. The first has x1.cc linked first, the second
58
# has x3.cc linked first.  The difference is that in the first one,
59
# the Info instantiation from x1.cc is taken, in the second, its
60
# from x3.cc.
61
 
62
for {set filenum 0} {$filenum < 2} {incr filenum 1} {
63
 
64
    # Lets test some commons
65
    # Need to restart each to to make sure objects are not loaded
66
    # Also cross check the address with what is actually in the
67
    #   object file (call the executable ${symaddrfile} to retrieve the
68
    #   information).
69
 
70
    set exec_output [lindex [remote_exec build "${symaddrfile} ${binfile}${filenum} acomm"] 1]
71
    regsub -all "\[\r\n\]" ${exec_output} "" exec_output
72
 
73
    gdb_exit
74
    gdb_start
75
    gdb_reinitialize_dir ${srcsubdir}
76
    gdb_load ${binfile}${filenum}
77
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
78
 
79
    gdb_exit
80
    gdb_start
81
    gdb_reinitialize_dir ${srcsubdir}
82
    gdb_load ${binfile}${filenum}
83
    gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
84
    gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*20.*acomm.*=.*1.*"
85
    gdb_test "s 1" "21.*"
86
    gdb_test "p acomm" ".* = 1.*"
87
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
88
 
89
    # Step through each line.
90
    # Do this three times.
91
    #   First round:  Test that things are okay after printing commons
92
    #                 above.
93
    #   Second round: Restart gdb and make sure we can walk through
94
    #   Third round:  Do NOT restrart gdb to verify that the debug information
95
    #                 was not messed up by loading additional object files from
96
    #                 the first run through.
97
    for {set i 0} {$i < 3} {incr i 1} {
98
        if $i==1 then {
99
            gdb_exit
100
            gdb_start
101
            gdb_reinitialize_dir ${srcsubdir}
102
            gdb_load ${binfile}${filenum}
103
        }
104
        if $i!=2 then {
105
            gdb_test "b main" \
106
                "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
107
        }
108
        if $i!=0 then {
109
            gdb_test "run" \
110
                "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*"
111
            gdb_test "s 1" "21.*"
112
        }
113
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
114
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
115
        gdb_test "s 1" ".*9.*"
116
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
117
        gdb_test "s 1" "main .*/x1.cc:22.*"
118
        gdb_test "s 1" "foo .*/x3.cc:5.*"
119
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
120
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
121
        gdb_test "s 1" ".*9.*"
122
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
123
        gdb_test "s 1" "foo .*/x3.cc:6.*"
124
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
125
        gdb_test "s 1" "QQ::print .*/x2.cc:13.*"
126
        gdb_test "s 1" ".*14.*"
127
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
128
        gdb_test "s 1" "foo .*/x3.cc:7.*"
129
        gdb_test "s 1" "main .*/x1.cc:24.*"
130
        gdb_test "s 1" ".*25.*"
131
        if [istarget "hppa64-*-*"] {
132
            gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
133
            gdb_test "c" ".*Program exited normally.*"
134
        } else {
135
            gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
136
            gdb_test "s 1" ".*Program exited normally.*"
137
        }
138
    }
139
 
140
    # Test various ptypes, and combinations of them
141
    # Test things multiple times in each set to make sure that the debug
142
    #   information did not get messed up.
143
 
144
    gdb_exit
145
    gdb_start
146
    gdb_reinitialize_dir ${srcsubdir}
147
    gdb_load ${binfile}${filenum}
148
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
149
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
150
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
151
 
152
    gdb_exit
153
    gdb_start
154
    gdb_reinitialize_dir ${srcsubdir}
155
    gdb_load ${binfile}${filenum}
156
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
157
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
158
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
159
 
160
    gdb_exit
161
    gdb_start
162
    gdb_reinitialize_dir ${srcsubdir}
163
    gdb_load ${binfile}${filenum}
164
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
165
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
166
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
167
 
168
    gdb_exit
169
    gdb_start
170
    gdb_reinitialize_dir ${srcsubdir}
171
    gdb_load ${binfile}${filenum}
172
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
173
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
174
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
175
 
176
    gdb_exit
177
    gdb_start
178
    gdb_reinitialize_dir ${srcsubdir}
179
    gdb_load ${binfile}${filenum}
180
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
181
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
182
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
183
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
184
 
185
    gdb_exit
186
    gdb_start
187
    gdb_reinitialize_dir ${srcsubdir}
188
    gdb_load ${binfile}${filenum}
189
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
190
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
191
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
192
 
193
    gdb_exit
194
    gdb_start
195
    gdb_reinitialize_dir ${srcsubdir}
196
    gdb_load ${binfile}${filenum}
197
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
198
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
199
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
200
 
201
    gdb_exit
202
    gdb_start
203
    gdb_reinitialize_dir ${srcsubdir}
204
    gdb_load ${binfile}${filenum}
205
    gdb_test "ptype class Info" \
206
        "type = (class |)Info {..*void p( |)..*}.*"
207
    gdb_test "ptype class Info" \
208
        "type = (class |)Info {..*void p( |)..*}.*"
209
    gdb_test "ptype class Info" \
210
        "type = (class |)Info {..*void p( |)..*}.*"
211
 
212
    gdb_exit
213
    gdb_start
214
    gdb_reinitialize_dir ${srcsubdir}
215
    gdb_load ${binfile}${filenum}
216
    gdb_test "ptype class Info" \
217
        "type = (class |)Info {..*void p( |)..*}.*"
218
    gdb_test "ptype class Info" \
219
        "type = (class |)Info {..*void p( |)..*}.*"
220
    gdb_test "ptype class Info" \
221
        "type = (class |)Info {..*void p( |)..*}.*"
222
}
223
 

powered by: WebSVN 2.1.0

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