Re: RFC: next/finish/etc -vs- exceptions

Jan Kratochvil
2010-12-11T05:27:08Z

On Fri, 10 Dec 2010 21:07:02 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Here is what I am testing.

OK. Included a ChangeLog entry.

Thanks,
Jan

gdb.testsuite/
2010-12-11 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.cp/nextoverthrow.cc (dummy): Return int 0.
(NextOverThrowDerivates) <resumebpt>: New.
(main): New block for test of "resumebpt".
* gdb.cp/nextoverthrow.exp: New block for test of "resumebpt".

--- a/gdb/testsuite/gdb.cp/nextoverthrow.cc
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.cc
@@ -19,8 +19,9 @@

using namespace std;

-void dummy ()
+int dummy ()
{
+ return 0;
}

class NextOverThrowDerivates
@@ -89,6 +90,18 @@ public:
function1 (val); // until here
}

+ void resumebpt (int val)
+ {
+ try
+ {
+ throw val;
+ }
+ catch (int x)
+ {
+ dummy ();
+ }
+ }
+
};
NextOverThrowDerivates next_cases;

@@ -198,6 +211,18 @@ int main ()
testval = val; // End: advance
}

+ // Test of "resumebpt".
+ try
+ {
+ next_cases.resumebpt (10); // Start: resumebpt
+ next_cases.resumebpt (11); // Second: resumebpt
+ }
+ catch (int val)
+ {
+ dummy ();
+ testval = val; // End: resumebpt
+ }
+
testval = 32; // done
}

diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
index 960ea0d..c19674f 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
@@ -149,5 +149,14 @@ gdb_test "advance $line" ".*" "advance-over-throw"
tbreak_and_cont "End: advance"
verify_testval "pre-check - advance" 8

+tbreak_and_cont "Start: resumebpt"
+gdb_test "tbreak _Unwind_RaiseException"
+gdb_test "continue" "Temporary breakpoint.*" "continuing to _Unwind_RaiseException"
+gdb_test "finish" "Run till exit .*"
+gdb_test {set $retpc=$pc}
+gdb_test {break *$retpc if dummy ()}
+tbreak_and_cont "Second: resumebpt"
+gdb_test "next"
+
tbreak_and_cont "done"
verify_testval "post-check - advance" 9