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.threads/] [pending-step.exp] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright (C) 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
# Test that a resume cancels a previously unfinished or unreported
17
# single-step correctly.
18
#
19
# The test consists of several threads all running the same loop.
20
# There is a breakpoint set in the loop, hence all threads may hit it.
21
# The test then issues several "next" commands in a loop.
22
#
23
# scheduler-locking must be set to the default of "off".
24
#
25
# Here's what would happen in gdbserver:
26
#
27
# 1) We issue a "continue", and wait until a thread hits the
28
#    breakpoint.  Could be any thread, but assume thread 1 hits it.
29
#
30
# 2) We issue a "next" --- this single-steps thread 1, and resumes all
31
#    other threads.
32
#
33
# 3) thread 2, due to scheduler-locking off, hits the breakpoint.
34
#    gdbserver stops all other threads by sending them SIGSTOPs.
35
#
36
# 4) While being stopped in step 3, thread 1 reports a SIGTRAP, that
37
#    corresponds to the finished single-step of step 2.  gdbserver
38
#    leaves the SIGTRAP pending to report later.
39
#
40
# 5) We issue another "next" --- this requests thread 2 to
41
#    single-step, and all other threads to continue, including thread
42
#    1.  Before resuming any thread, gdbserver notices that it
43
#    remembers from step 4 a pending SIGTRAP to report for thread 1,
44
#    so reports it now.
45
#
46
# 6) From GDB's perpective, this SIGTRAP can't represent a finished
47
#    single-step, since thread 1 was not single-stepping (it was
48
#    continued in step 5).  Neither does this SIGTRAP correspond to a
49
#    breakpoint hit.  GDB reports to the user a spurious SIGTRAP.
50
 
51
set testfile "pending-step"
52
set srcfile ${testfile}.c
53
set binfile ${objdir}/${subdir}/${testfile}
54
 
55
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
56
    return -1
57
}
58
 
59
# Start with a fresh gdb.
60
 
61
gdb_exit
62
gdb_start
63
gdb_reinitialize_dir $srcdir/$subdir
64
gdb_load ${binfile}
65
 
66
if ![runto_main] then {
67
    fail "Can't run to main"
68
    return 0
69
}
70
 
71
gdb_breakpoint [gdb_get_line_number "insert breakpoint here"]
72
gdb_continue_to_breakpoint "continue to first breakpoint hit"
73
 
74
set test "next in multiple threads with breakpoints"
75
set iterations 20
76
set ok 0
77
for {set i 0} {$i < $iterations} {incr i} {
78
    set ok 0
79
    gdb_test_multiple "next" "$test" {
80
        -re "SIGTRAP.*$gdb_prompt $" {
81
            fail "$test (spurious SIGTRAP)"
82
        }
83
        -re "$gdb_prompt $" {
84
            set ok 1
85
        }
86
    }
87
 
88
    if { $ok == 0 } {
89
        break
90
    }
91
}
92
 
93
if { $ok  } {
94
    pass "$test"
95
}

powered by: WebSVN 2.1.0

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