| OLD | NEW |
| 1 # Copyright 1997-1998, 2004-2005, 2007-2012 Free Software Foundation, | 1 # Copyright 1997-2013 Free Software Foundation, Inc. |
| 2 # Inc. | |
| 3 | 2 |
| 4 # This program is free software; you can redistribute it and/or modify | 3 # 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 | 4 # 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
| 7 # (at your option) any later version. | 6 # (at your option) any later version. |
| 8 # | 7 # |
| 9 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 # Set a catch catchpoint | 49 # Set a catch catchpoint |
| 51 | 50 |
| 52 gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \ | 51 gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \ |
| 53 "catch catch (before inferior run)" | 52 "catch catch (before inferior run)" |
| 54 | 53 |
| 55 # Set a throw catchpoint | 54 # Set a throw catchpoint |
| 56 | 55 |
| 57 gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \ | 56 gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \ |
| 58 "catch throw (before inferior run)" | 57 "catch throw (before inferior run)" |
| 59 | 58 |
| 59 # Set a rethrow catchpoint |
| 60 |
| 61 gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)" \ |
| 62 "catch rethrow (before inferior run)" |
| 63 |
| 60 | 64 |
| 61 # The catchpoints should be listed in the list of breakpoints. | 65 # The catchpoints should be listed in the list of breakpoints. |
| 62 # In case of a statically linked test, we won't have a pending breakpoint. | 66 # In case of a statically linked test, we won't have a pending breakpoint. |
| 63 # Hence we allow for both an address or "<PENDING>". If we ever become able | 67 # Hence we allow for both an address or "<PENDING>". If we ever become able |
| 64 # to tell whether the target is linked statically or not, we can be more | 68 # to tell whether the target is linked statically or not, we can be more |
| 65 # precise and require exact output. | 69 # precise and require exact output. |
| 66 set addr "\(<PENDING>|$hex\)" | 70 set addr "\(<PENDING>|$hex\)" |
| 67 set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" | 71 set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" |
| 68 set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" | 72 set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" |
| 69 set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" | 73 set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" |
| 74 set re_4_bp "3${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception rethrow" |
| 70 | 75 |
| 71 set name "info breakpoints (before inferior run)" | 76 set name "info breakpoints (before inferior run)" |
| 72 gdb_test_multiple "info breakpoints" $name { | 77 gdb_test_multiple "info breakpoints" $name { |
| 73 -re "$re_head${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { | 78 -re "$re_head${ws}$re_2_bp${ws}$re_3_bp${ws}$re_4_bp\r\n$gdb_prompt $" { |
| 74 pass $name | 79 pass $name |
| 75 } | 80 } |
| 76 -re ".*$gdb_prompt $" | 81 -re ".*$gdb_prompt $" |
| 77 { | 82 { |
| 78 fail $name | 83 fail $name |
| 79 } | 84 } |
| 80 } | 85 } |
| 81 | 86 |
| 82 gdb_test "tbreak main" "Temporary breakpoint 3.*" \ | 87 gdb_test "tbreak main" "Temporary breakpoint 4.*" \ |
| 83 "Set temporary breakpoint at main" | 88 "Set temporary breakpoint at main" |
| 84 | 89 |
| 85 set ok 0 | 90 set ok 0 |
| 86 gdb_run_cmd | 91 gdb_run_cmd |
| 87 gdb_test_multiple "" "Run to main" { | 92 gdb_test_multiple "" "Run to main" { |
| 88 -re "Temporary breakpoint 3,.*$gdb_prompt $" { | 93 -re "Temporary breakpoint 4,.*$gdb_prompt $" { |
| 89 pass "Run to main" | 94 pass "Run to main" |
| 90 set ok 1 | 95 set ok 1 |
| 91 } | 96 } |
| 92 } | 97 } |
| 93 | 98 |
| 94 if { !$ok } { | 99 if { !$ok } { |
| 95 continue | 100 continue |
| 96 } | 101 } |
| 97 | 102 |
| 98 set addr "$hex" | 103 set addr "$hex" |
| 99 set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" | 104 set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" |
| 100 set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" | 105 set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" |
| 101 set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" | 106 set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" |
| 107 set re_4_bp "3${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception rethrow" |
| 102 | 108 |
| 103 set name "info breakpoints (after inferior run)" | 109 set name "info breakpoints (after inferior run)" |
| 104 gdb_test_multiple "info breakpoints" $name { | 110 gdb_test_multiple "info breakpoints" $name { |
| 105 -re "$re_head${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { | 111 -re "$re_head${ws}$re_2_bp${ws}$re_3_bp${ws}$re_4_bp\r\n$gdb_prompt $" { |
| 106 pass $name | 112 pass $name |
| 107 } | 113 } |
| 108 -re ".*$gdb_prompt $" | 114 -re ".*$gdb_prompt $" |
| 109 { | 115 { |
| 110 send_user "\n---\n$expect_out(buffer)\n---\n" | 116 send_user "\n---\n$expect_out(buffer)\n---\n" |
| 111 fail $name | 117 fail $name |
| 112 } | 118 } |
| 113 } | 119 } |
| 114 | 120 |
| 115 gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*" | 121 gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 set name "backtrace after second catch" | 209 set name "backtrace after second catch" |
| 204 gdb_test_multiple "backtrace" $name { | 210 gdb_test_multiple "backtrace" $name { |
| 205 -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$he
x in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { | 211 -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$he
x in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { |
| 206 pass $name | 212 pass $name |
| 207 } | 213 } |
| 208 } | 214 } |
| 209 | 215 |
| 210 # Continue to breakpoint on catcher. | 216 # Continue to breakpoint on catcher. |
| 211 gdb_test "continue" ".*catcher \\(x=13\\).*" "continue to catcher for the second
time" | 217 gdb_test "continue" ".*catcher \\(x=13\\).*" "continue to catcher for the second
time" |
| 212 | 218 |
| 213 # That is all for now. | 219 |
| 214 # | 220 # Continue to the re-throw. |
| 215 # The original code had: | 221 |
| 216 # | 222 gdb_test "continue" "Catchpoint \[0-9\]+.*exception rethrown.*" \ |
| 217 # continue to re-throw ; backtrace | 223 "continue to rethrow" |
| 218 # continue to catch ; backtrace | |
| 219 # continue to throw out of main | |
| 220 # | |
| 221 # The problem is that "re-throw" does not show a throw; only a catch. | |
| 222 # I do not know if this is because of a bug, or because the generated | |
| 223 # code is optimized for a throw into the same function. | |
| 224 # | |
| 225 # -- chastain 2004-01-09 | |
| OLD | NEW |