mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 09:14:14 +08:00
2011-06-28 Yao Qi <yao@codesourcery.com>
* gdb.cp/exception.cc: Don't include iostream. (bar): Remove print statement. (catcher): New. (main): Remove print statements. Call function catcher. * gdb.cp/exception.exp : Don't match inferior's output in regexp. Set breakpoint on catcher, and check the value of parameter.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2011-06-28 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.cp/exception.cc: Don't include iostream.
|
||||||
|
(bar): Remove print statement.
|
||||||
|
(catcher): New.
|
||||||
|
(main): Remove print statements. Call function catcher.
|
||||||
|
* gdb.cp/exception.exp : Don't match inferior's output in regexp.
|
||||||
|
Set breakpoint on catcher, and check the value of parameter.
|
||||||
|
|
||||||
2011-06-23 Yao Qi <yao@codesourcery.com>
|
2011-06-23 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* gdb.cp/mb-inline.exp: Parse the output of `info break' to check breakpoint
|
* gdb.cp/mb-inline.exp: Parse the output of `info break' to check breakpoint
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
// Test file for exception handling support.
|
// Test file for exception handling support.
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int foo (int i)
|
int foo (int i)
|
||||||
@ -36,10 +35,14 @@ extern "C" int bar (int k, unsigned long eharg, int flag);
|
|||||||
|
|
||||||
int bar (int k, unsigned long eharg, int flag)
|
int bar (int k, unsigned long eharg, int flag)
|
||||||
{
|
{
|
||||||
cout << "k is " << k << " eharg is " << eharg << " flag is " << flag << endl;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int catcher (int x)
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -48,7 +51,7 @@ int main()
|
|||||||
j = foo (20);
|
j = foo (20);
|
||||||
}
|
}
|
||||||
catch (int x) {
|
catch (int x) {
|
||||||
cout << "Got an except " << x << endl;
|
catcher (x);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -56,12 +59,12 @@ int main()
|
|||||||
j = foo (20);
|
j = foo (20);
|
||||||
}
|
}
|
||||||
catch (int x) {
|
catch (int x) {
|
||||||
cout << "Got an except " << x << endl;
|
catcher (x);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (int y) {
|
catch (int y) {
|
||||||
cout << "Got an except (rethrown) " << y << endl;
|
catcher (y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not caught
|
// Not caught
|
||||||
|
@ -127,6 +127,8 @@ gdb_test_multiple "info breakpoints" $name {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*"
|
||||||
|
|
||||||
# Get the first exception thrown
|
# Get the first exception thrown
|
||||||
|
|
||||||
set name "continue to first throw"
|
set name "continue to first throw"
|
||||||
@ -173,14 +175,17 @@ gdb_test_multiple "backtrace" $name {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Continue to breakpoint on catcher.
|
||||||
|
gdb_test "continue" ".*catcher \\(x=13\\).*" "continue to catcher for the first time"
|
||||||
|
|
||||||
# Continue to second throw.
|
# Continue to second throw.
|
||||||
|
|
||||||
set name "continue to second throw"
|
set name "continue to second throw"
|
||||||
gdb_test_multiple "continue" $name {
|
gdb_test_multiple "continue" $name {
|
||||||
-re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" {
|
-re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" {
|
||||||
pass $name
|
pass $name
|
||||||
}
|
}
|
||||||
-re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" {
|
-re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" {
|
||||||
pass $name
|
pass $name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,6 +222,9 @@ gdb_test_multiple "backtrace" $name {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Continue to breakpoint on catcher.
|
||||||
|
gdb_test "continue" ".*catcher \\(x=13\\).*" "continue to catcher for the second time"
|
||||||
|
|
||||||
# That is all for now.
|
# That is all for now.
|
||||||
#
|
#
|
||||||
# The original code had:
|
# The original code had:
|
||||||
|
Reference in New Issue
Block a user