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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [siginfo.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jlechner
# Copyright 2004, 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
 
17
# The program siginfo.c creates a backtrace containing a signal
18
# handler registered using sigaction's sa_sigaction / SA_SIGINFO.
19
# Some OS's (e.g., GNU/Linux) use different signal trampolines for
20
# sa_sigaction and sa_handler.
21
 
22
# This test first confirms that GDB can backtrace through the
23
# alternative sa_sigaction signal handler, and second that GDB can
24
# nexti/stepi out of such a handler.
25
 
26
if [target_info exists gdb,nosignals] {
27
    verbose "Skipping signals.exp because of nosignals."
28
    continue
29
}
30
 
31
if $tracelevel then {
32
    strace $tracelevel
33
}
34
 
35
set prms_id 0
36
set bug_id 0
37
 
38
set testfile siginfo
39
set srcfile ${testfile}.c
40
set binfile ${objdir}/${subdir}/${testfile}
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
42
    untested "Couldn't compile ${srcfile}.c"
43
    return -1
44
}
45
 
46
# get things started
47
gdb_exit
48
gdb_start
49
gdb_reinitialize_dir $srcdir/$subdir
50
gdb_load ${binfile}
51
 
52
gdb_test "display/i \$pc"
53
 
54
# Advance to main
55
if { ![runto_main] } then {
56
    gdb_suppress_tests;
57
}
58
 
59
# Pass all the alarms straight through (but verbosely)
60
# gdb_test "handle SIGALRM print pass nostop"
61
# gdb_test "handle SIGVTALRM print pass nostop"
62
# gdb_test "handle SIGPROF print pass nostop"
63
 
64
# Run to the signal handler, validate the backtrace.
65
gdb_test "break handler"
66
gdb_test "continue" ".* handler .*" "continue to stepi handler"
67
send_gdb "bt\n"
68
gdb_expect_list "backtrace for nexti" ".*$gdb_prompt $" {
69
    "\[\r\n\]+.0 \[^\r\n\]* handler "
70
    "\[\r\n\]+.1  .signal handler called."
71
    "\[\r\n\]+.2 \[^\r\n\]* main .*"
72
}
73
 
74
# Check that GDB can step the inferior back to main
75
set test "step out of handler"
76
gdb_test_multiple "step" "${test}" {
77
    -re "Could not insert single-step breakpoint.*$gdb_prompt $" {
78
        setup_kfail sparc*-*-openbsd* gdb/1736
79
        fail "$test (could not insert single-step breakpoint)"
80
    }
81
    -re "done = 1;.*${gdb_prompt} $" {
82
        send_gdb "$i\n"
83
        exp_continue
84
    }
85
    -re "\} .. handler .*${gdb_prompt} $" {
86
        send_gdb "step\n"
87
        exp_continue
88
    }
89
    -re "Program exited normally.*${gdb_prompt} $" {
90
        kfail gdb/1613 "$test (program exited)"
91
    }
92
    -re "(while ..done|return 0).*${gdb_prompt} $" {
93
        # After stepping out of a function /r signal-handler, GDB will
94
        # advance the inferior until it is at the first instruction of
95
        # a code-line.  While typically things return to the middle of
96
        # the "while..." (and hence GDB advances the inferior to the
97
        # "return..." line) it is also possible for the return to land
98
        # on the first instruction of "while...".  Accept both cases.
99
        pass "$test"
100
    }
101
}

powered by: WebSVN 2.1.0

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