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.ada/] [catch_ex.exp] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 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
if $tracelevel then {
17
    strace $tracelevel
18
}
19
 
20
load_lib "ada.exp"
21
 
22
set testdir "catch_ex"
23
set testfile "${testdir}/foo"
24
set srcfile ${srcdir}/${subdir}/${testfile}.adb
25
set binfile ${objdir}/${subdir}/${testfile}
26
 
27
file mkdir ${objdir}/${subdir}/${testdir}
28
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
29
  return -1
30
}
31
 
32
gdb_exit
33
gdb_start
34
gdb_reinitialize_dir $srcdir/$subdir
35
gdb_load ${binfile}
36
 
37
# Some global variables used to simplify the maintenance of some of
38
# the regular expressions below.
39
set any_nb "\[0-9\]+"
40
set any_addr "0x\[0-9a-zA-Z\]+"
41
set eol "\[\r\n\]+"
42
set sp "\[ \t\]*"
43
 
44
set info_break_header "Num${sp}Type${sp}Disp${sp}Enb${sp}Address${sp}What"
45
set catch_exception_info \
46
  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}all Ada exceptions"
47
 
48
####################################
49
# 1. Try catching all exceptions.  #
50
####################################
51
 
52
if ![runto_main] then {
53
   fail "Cannot run to main, testcase aborted"
54
   return 0
55
}
56
 
57
set msg "insert catchpoint on all Ada exceptions"
58
gdb_test_multiple "catch exception" $msg {
59
    -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" {
60
        pass $msg
61
    }
62
    -re "Cannot break on __gnat_raise_nodefer_with_msg in this configuration\.$eol$gdb_prompt $" {
63
        # If the runtime was not built with enough debug information,
64
        # or if it was stripped, we can not test exception
65
        # catchpoints.
66
        unsupported $msg
67
        return -1
68
    }
69
}
70
 
71
gdb_test "info break" \
72
         "$info_break_header$eol.*$catch_exception_info" \
73
         "info break, catch all Ada exceptions"
74
 
75
set catchpoint_msg \
76
  "Catchpoint $any_nb, CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
77
gdb_test "continue" \
78
         "Continuing\.$eol$catchpoint_msg$eol.*SPOT1" \
79
         "continuing to first exception"
80
 
81
set catchpoint_msg \
82
  "Catchpoint $any_nb, PROGRAM_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
83
gdb_test "continue" \
84
         "Continuing\.$eol$catchpoint_msg$eol.*SPOT2" \
85
         "continuing to second exception"
86
 
87
################################################
88
# 2. Try catching only some of the exceptions. #
89
################################################
90
 
91
# Here is the scenario:
92
#  - Restart the debugger from scratch, runto_main
93
#  - We'll catch only "Program_Error"
94
#    We'll catch assertions
95
#    We'll catch unhandled exceptions
96
#  - continue, we should see the first Program_Error exception
97
#  - continue, we should see the failed assertion
98
#  - continue, we should see the unhandled Constrait_Error exception
99
#  - continue, the program exits.
100
 
101
if ![runto_main] then {
102
   fail "Cannot run to main, testcase aborted"
103
   return 0
104
}
105
 
106
gdb_test "catch exception Program_Error" \
107
         "Catchpoint $any_nb: \`Program_Error' Ada exception" \
108
         "insert catchpoint on Program_Error"
109
 
110
gdb_test "catch assert" \
111
         "Catchpoint $any_nb: failed Ada assertions" \
112
         "insert catchpoint on failed assertions"
113
 
114
gdb_test "catch exception unhandled" \
115
         "Catchpoint $any_nb: unhandled Ada exceptions" \
116
         "insert catchpoint on unhandled exceptions"
117
 
118
set catch_exception_entry \
119
  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}\`Program_Error' Ada exception"
120
set catch_assert_entry \
121
  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}failed Ada assertions"
122
set catch_unhandled_entry \
123
  "$any_nb${sp}breakpoint${sp}keep${sp}y${sp}$any_addr${sp}unhandled Ada exceptions"
124
 
125
gdb_test "info break" \
126
         "$info_break_header$eol.*$catch_exception_entry$eol$catch_assert_entry$eol$catch_unhandled_entry" \
127
         "info break, second run"
128
 
129
set catchpoint_msg \
130
  "Catchpoint $any_nb, PROGRAM_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
131
gdb_test "continue" \
132
         "Continuing\.$eol$catchpoint_msg$eol.*SPOT2" \
133
         "continuing to Program_Error exception"
134
 
135
set catchpoint_msg \
136
  "Catchpoint $any_nb, failed assertion at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
137
gdb_test "continue" \
138
         "Continuing\.$eol$catchpoint_msg$eol.*SPOT3" \
139
         "continuing to failed assertion"
140
 
141
set catchpoint_msg \
142
  "Catchpoint $any_nb, unhandled CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
143
gdb_test "continue" \
144
         "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
145
         "continuing to unhandled exception"
146
 
147
gdb_test "continue" \
148
         "Continuing\..*Program exited.*" \
149
         "continuing to program completion"
150
 
151
 

powered by: WebSVN 2.1.0

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