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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [annota1.exp] - Blame information for rev 231

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2
# 2010 Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
 
24
# are we on a target board? If so, don't run these tests.
25
# note: this is necessary because we cannot use runto_main (which would
26
# work for remote targets too) because of the different prompt we get
27
# when using annotation level 2.
28
#
29
if [is_remote target] then {
30
    return 0
31
}
32
 
33
 
34
#
35
# test running programs
36
#
37
set prms_id 0
38
set bug_id 0
39
 
40
set testfile "annota1"
41
set srcfile ${testfile}.c
42
set binfile ${objdir}/${subdir}/${testfile}
43
 
44
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
45
    untested annota1.exp
46
    return -1
47
}
48
 
49
 
50
gdb_exit
51
gdb_start
52
gdb_reinitialize_dir $srcdir/$subdir
53
gdb_load ${binfile}
54
 
55
if [target_info exists gdb_stub] {
56
    gdb_step_for_stub;
57
}
58
 
59
#
60
# the line at which break main will put the breakpoint
61
#
62
set main_line 32
63
 
64
# The commands we test here produce many lines of output; disable "press
65
#  to continue" prompts.
66
send_gdb "set height 0\n"
67
gdb_expect -re "$gdb_prompt $"
68
 
69
#
70
# break at main
71
#
72
gdb_test "break main" \
73
    "Breakpoint.*at.* file .*$srcfile, line.*" \
74
    "breakpoint main"
75
 
76
 
77
#
78
# NOTE: this prompt is OK only when the annotation level is > 1
79
# NOTE: When this prompt is in use the gdb_test procedure cannot be used because
80
# it assumes that the last char after the gdb_prompt is a white space. This is not
81
# true with this annotated prompt. So we must use send_gdb and gdb_expect.
82
#
83
 
84
set old_gdb_prompt $gdb_prompt
85
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
86
 
87
#
88
# Escape all the characters in the path that need it. For instance
89
# the directory name could contain '+'.
90
#
91
set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
92
 
93
 
94
#
95
# set the annotation level to 2
96
#
97
# of course, this will test:
98
# annotate-pre-prompt
99
# annotate-prompt
100
# annotate-post-prompt (in the next block)
101
#
102
send_gdb "set annotate 2\n"
103
gdb_expect {
104
    -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
105
    -re ".*$gdb_prompt$"       { fail "annotation set at level 2" }
106
    timeout                 { fail "annotation set at level 2 (timeout)" }
107
  }
108
 
109
 
110
#
111
# info break will test:
112
# annotate-breakpoints-headers
113
# annotate-field
114
# annotate-breakpoints-table
115
# annotate-record
116
# annotate-breakpoints-table-end
117
#
118
send_gdb "info break\n"
119
gdb_expect {
120
    -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum     \r\n\032\032field 1\r\nType           \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress    +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1       \r\n\032\032field 1\r\nbreakpoint     \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny   \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \
121
        {pass "breakpoint info"}
122
    -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum     \r\n\032\032field 1\r\nType           \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress    +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1       \r\n\032\032field 1\r\nbreakpoint     \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny   \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \
123
        { setup_xfail "*-*-*" 1270
124
          fail "breakpoint info"}
125
   -re ".*$gdb_prompt$" { fail "breakpoint info" }
126
   timeout { fail "breakpoint info (timeout)" }
127
}
128
 
129
 
130
#
131
# run to a break point will test:
132
# annotate-frames-invalid
133
# annotate-breakpoints-invalid (a.k.a. breakpoints-changed)
134
# annotate-starting
135
# annotate-breakpoint
136
# annotate-frame-begin
137
# annotate-frame-function-name
138
# annotate-frame-args
139
# annotate-frame-source-begin
140
# annotate-frame-source-file
141
# annotate-frame-source-file-end
142
# annotate-frame-source-line
143
# annotate-frame-source-end
144
# annotate-source
145
# annotate-frame-end
146
# annotate-stopped
147
#
148
#exp_internal 1
149
set binexp [string_to_regexp $binfile]
150
send_gdb "run\n"
151
gdb_expect {
152
    -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)+\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
153
        pass "run until main breakpoint"
154
    }
155
    -re ".*$gdb_prompt$" {
156
        fail "run until main breakpoint"
157
    }
158
    timeout {
159
        fail "run until main breakpoint (timeout)"
160
    }
161
  }
162
#exp_internal 0
163
#exit 0
164
 
165
#
166
# Let's do a next, to get to a point where the array is initialized
167
# We don't care about the annotated output for this operation, it is the same as
168
# the one produced by run above
169
#
170
send_gdb "next\n"
171
gdb_expect {
172
    -re ".*$gdb_prompt$" { pass "go after array init line" }
173
    timeout { fail "go after array init line (timeout)" }
174
}
175
 
176
 
177
#
178
# printing the array will test:
179
# annotate-value-history-begin
180
# annotate-value-history-value
181
# annotate-array-section-begin
182
# annotate-elt
183
# FIXME: annotate-elt-rep and annotate-elt-rep-end not tested
184
# annotate-array-section-end
185
# annotate-value-history-end
186
# FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output
187
#              command would cause them to be used)
188
#
189
send_gdb "print my_array\n"
190
gdb_expect {
191
  -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \
192
        { pass "print array" }
193
  -re ".*$gdb_prompt$"     { fail "print array" }
194
  timeout                   { fail "print array (timeout)" }
195
}
196
 
197
 
198
#
199
# this should generate an error message, so to test:
200
# annotate-error-begin
201
# FIXME: annotate-error not tested
202
#
203
 
204
#exp_internal 1
205
send_gdb "print non_existent_value\n"
206
gdb_expect {
207
  -re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" \
208
        { pass "print non_existent_value" }
209
  -re ".*$gdb_prompt$"     { fail "print non_existent_value" }
210
  timeout                   { fail "print non_existent_value (timeout)" }
211
}
212
 
213
 
214
#
215
# break at signal handler. So that, once we are in the sig handler, if we do a bt
216
# we can test annotate-signal-handler-caller
217
#
218
send_gdb "break handle_USR1\n"
219
gdb_expect {
220
  -re  "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \
221
            { pass "breakpoint handle_USR1" }
222
  -re ".*$gdb_prompt$"     { fail "break at handle_USR1" }
223
  timeout                   { fail "break at handle_USR1 (timeout)" }
224
}
225
 
226
#
227
# break at printf. When we are stopped at printf, we can test
228
#
229
send_gdb "break printf\n"
230
gdb_expect {
231
  -re  "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \
232
            { pass "breakpoint printf" }
233
  -re  "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \
234
            { pass "breakpoint printf"}
235
  -re ".*$gdb_prompt$"     { fail "break printf" }
236
  timeout                   { fail "break printf (timeout)" }
237
}
238
 
239
#
240
# get to printf
241
#
242
set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n"
243
set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n"
244
set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$"
245
 
246
gdb_test_multiple "continue" "continue to printf" {
247
    -re "${pat_begin}($pat_adjust)?$pat_end" {
248
        pass "continue to printf"
249
    }
250
    -re ".*$gdb_prompt$"     { fail "continue to printf" }
251
}
252
 
253
#
254
# test:
255
# annotate-frame-where
256
# annotate-frame-address
257
# annotate-frame-address-end
258
#
259
set pat_begin "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0  \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1  \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n"
260
set pat_end "\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$"
261
send_gdb "backtrace\n"
262
gdb_expect {
263
    -re "$pat_begin$escapedsrcfile$pat_end"
264
          { pass "backtrace from shlibrary" }
265
    -re "$pat_begin.*$srcfile$pat_end"
266
          { setup_xfail "*-*-*" 1270
267
            fail "backtrace from shlibrary" }
268
    -re ".*$gdb_prompt$"     { fail "backtrace from shlibrary" }
269
    timeout                 { fail "backtrace from shlibrary (timeout)" }
270
}
271
 
272
 
273
#
274
# test printing a frame with some arguments:
275
# annotate-arg-begin
276
# annotate-arg-name-end
277
# annotate-arg-value
278
# annotate-arg-end
279
#
280
 
281
if [target_info exists gdb,nosignals] {
282
    unsupported "send SIGUSR1"
283
    unsupported "backtrace @ signal handler"
284
} else {
285
    send_gdb "signal SIGUSR1\n"
286
    gdb_expect {
287
        -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
288
            { pass "send SIGUSR1" }
289
        -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
290
            { setup_xfail "*-*-*" 1270
291
              fail "send SIGUSR1" }
292
      -re ".*$gdb_prompt$"     { fail "send SIGUSR1" }
293
      timeout               { fail "send SIGUSR1 (timeout)" }
294
    }
295
 
296
    #
297
    # test:
298
    # annotate-signal-handler-caller
299
    #
300
    send_gdb "backtrace\n"
301
    gdb_expect {
302
        -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" {
303
            pass "backtrace @ signal handler"
304
        }
305
        -re ".*$gdb_prompt$"   { fail "backtrace @ signal handler" }
306
        timeout                { fail "backtrace @ signal handler (timeout)" }
307
    }
308
}
309
 
310
#
311
# delete all the breakpoints
312
#
313
send_gdb "delete 1\n"
314
gdb_expect {
315
     -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
316
          { pass "delete bp 1" }
317
     -re ".*$gdb_prompt$"  { fail "delete bp 1" }
318
     timeout { fail "delete bp 1 (timeout)" }
319
}
320
 
321
send_gdb "delete 2\n"
322
gdb_expect {
323
     -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
324
             { pass "delete bp 2" }
325
     -re ".*$gdb_prompt$"  { fail "delete bp 2 " }
326
     timeout { fail "delete bp 2 (timeout)" }
327
}
328
 
329
send_gdb "delete 3\n"
330
gdb_expect {
331
     -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
332
             { pass "delete bp 3" }
333
     -re ".*$gdb_prompt$"  { fail "delete bp 3" }
334
     timeout { fail "delete bp 3 (timeout)" }
335
}
336
 
337
#
338
# break at main, after value is initialized. This is in preparation
339
# to test the annotate output for the display command.
340
#
341
send_gdb "break main\n"
342
gdb_expect {
343
    -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" \
344
             { pass "break at 28" }
345
    -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" \
346
             { setup_xfail "*-*-*" 1270
347
               fail "break at 28" }
348
     -re ".*$gdb_prompt$"  { fail "break at 28" }
349
     timeout { fail "break at 28 (timeout)" }
350
}
351
 
352
#
353
# display the value; test:
354
# annotate-display-begin
355
# annotate-display-number-end
356
# annotate-display-format
357
# annotate-display-expression
358
# annotate-display-expression-end
359
# annotate-display-end
360
# FIXME: annotate-display-value not tested
361
#
362
send_gdb "display value\n"
363
gdb_expect {
364
    -re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" \
365
             { pass "set up display" }
366
     -re ".*$gdb_prompt$"  { fail "set up display" }
367
     timeout { fail "set up display (timeout)" }
368
}
369
 
370
 
371
# should ask query. Test annotate-query.
372
# we don't care about anything else here, only the query.
373
 
374
send_gdb "run\n"
375
gdb_expect {
376
  -re "pre-query.*already.*\\(y or n\\).*query\r\n" {
377
         send_gdb "y\n"
378
         gdb_expect {
379
             -re ".*post-query.*$gdb_prompt$" \
380
                     { pass "re-run" }
381
             -re ".*$gdb_prompt$"  { fail "re-run" }
382
             timeout { fail "re-run (timeout)" }
383
         }
384
     }
385
  -re ".*$gdb_prompt$"  { fail "re-run" }
386
  timeout { fail "re-run (timeout)" }
387
}
388
 
389
#
390
# Test that breakpoints-invalid is issued once and only once for
391
# breakpoint ignore count changes, after annotation stopped.
392
#
393
send_gdb "break 46\n"
394
gdb_expect {
395
    -re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" {
396
        pass "break at 46"
397
    }
398
    -re ".*$gdb_prompt$" { fail "break at 46" }
399
    timeout { fail "break at 46 (timeout)" }
400
}
401
 
402
send_gdb "ignore 5 4\n"
403
gdb_expect {
404
    -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" {
405
        pass "ignore 5 4"
406
    }
407
    -re ".*$gdb_prompt$" { fail "ignore 5 4" }
408
    timeout { fail "ignore 5 4 (timeout)" }
409
}
410
 
411
send_gdb "continue\n"
412
gdb_expect {
413
    -re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" {
414
        pass "annotate ignore count change"
415
    }
416
    -re ".*$gdb_prompt$" { fail "annotate ignore count change" }
417
    timeout { fail "annotate ignore count change (timeout)" }
418
}
419
 
420
# check that ignore command is working, or the above can provide
421
# misleading assurance ...
422
 
423
send_gdb "next\n"
424
gdb_expect {
425
    -re "$gdb_prompt$" {}
426
    timeout { fail "next to exit loop" }
427
}
428
 
429
send_gdb "next\n"
430
gdb_expect {
431
    -re ".*$srcfile:49:.*$gdb_prompt$" {
432
        pass "breakpoint ignore count"
433
    }
434
    -re ".*$gdb_prompt$" { fail "breakpoint ignore count" }
435
    timeout { fail "breakpoint ignore count (timeout)" }
436
}
437
 
438
#
439
# Send a signal that is not handled; test:
440
# annotate-signalled
441
# annotate-signal-name
442
# annotate-signal-name-end
443
# annotate-signal-string
444
# annotate-signal-string-end
445
# FIXME: annotate-signal not tested (requires that the inferior be
446
#                        stopped by a "random" signal)
447
#
448
# SIGTRAP signals are dropped before they get to the inferior process
449
# on hpux11.  In theory, this behaivor can be controlled by setting
450
# TTEO_NORM_SIGTRAP in the inferior, but doing so did not cause
451
# the signal to be properly delivered.
452
#
453
# It has been verified that other signals will be delivered.  However,
454
# rather than twiddle the test, I choose to leave it as-is as it
455
# exposes an interesting failure on hpux11.
456
 
457
if [target_info exists gdb,nosignals] {
458
    unsupported "signal sent"
459
} else {
460
    setup_xfail hppa*-*-hpux11*
461
    send_gdb "signal SIGTRAP\n"
462
    gdb_expect {
463
      -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
464
              { pass "signal sent" }
465
      -re ".*$gdb_prompt$" { fail "signal sent" }
466
      timeout { fail "signal sent (timeout)" }
467
    }
468
}
469
 
470
 
471
# Check for production of a core file and remove it!
472
 
473
set exec_output [remote_exec build "ls core"]
474
 
475
set test "cleanup core file"
476
if [ regexp "core not found" $exec_output]  {
477
    pass "$test (not dumped)"
478
} else {
479
    if [ regexp "No such file or directory" $exec_output] {
480
        pass "$test (not dumped)"
481
    } else {
482
        remote_exec build "rm -f core"
483
        pass "$test (removed)"
484
    }
485
}
486
 
487
proc thread_test {} {
488
    global objdir subdir srcdir testfile
489
    global gdb_prompt old_gdb_prompt
490
    set srcfile watch_thread_num.c
491
    set binfile ${objdir}/${subdir}/${testfile}-watch_thread_num
492
    set gdb_prompt $old_gdb_prompt
493
 
494
    if { ![get_compiler_info ${binfile}] && [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
495
 
496
        gdb_exit
497
        gdb_start
498
        gdb_reinitialize_dir $srcdir/$subdir
499
        gdb_load ${binfile}
500
        if { ![runto main] } then {
501
            fail "run to main"
502
            return
503
        }
504
 
505
        set gdb_prompt \
506
            "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
507
 
508
        send_gdb "set annotate 2\n"
509
        gdb_expect {
510
        -re "set annotate 2\r\n$gdb_prompt$" {}
511
        }
512
 
513
        send_gdb "next 2\n"
514
        gdb_expect {
515
            -re ".*\032\032new-thread" {
516
            pass "new thread"
517
            }
518
            timeout { fail "new thread (timeout)" }
519
        }
520
    }
521
}
522
 
523
proc thread_switch {} {
524
        send_gdb "thread 1\n"
525
        gdb_expect {
526
            -re ".*\032\032thread-changed" {
527
            pass "thread switch"
528
            }
529
            timeout { fail "thread switch (timeout)" }
530
        }
531
}
532
 
533
thread_test
534
thread_switch
535
 
536
# restore the original prompt for the rest of the testsuite
537
 
538
set gdb_prompt $old_gdb_prompt

powered by: WebSVN 2.1.0

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