Skip to content
Snippets Groups Projects
Commit 9ce64a11 authored by Avi Kivity's avatar Avi Kivity Committed by Pekka Enberg
Browse files

tst-except: add test for _Unwind_Resume


Previously, _Unwind_Resume wasn't available, so functions that handled an
exception implicitly (by running a few destructors) crashed.

Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent be565320
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
#include <debug.hh>
#include <exception>
#include <setjmp.h>
#include <memory>
int tests = 0, fails = 0;
......@@ -27,6 +28,26 @@ void myterminate()
longjmp(env, 1);
}
void function_that_throws()
{
throw 0;
}
void function_with_landing_point()
{
std::shared_ptr<int> ptr = std::make_shared<int>(7);
function_that_throws();
}
void test_unwind_resume()
{
try {
function_with_landing_point();
} catch (int x) {
report(true, "_Unwind_Resume");
}
}
int main(int ac, char** av)
{
// Test simple throw of an integer.
......@@ -37,6 +58,8 @@ int main(int ac, char** av)
report (e == 1, "catch 1");
}
test_unwind_resume();
// Test that unhandled exceptions work and indeed call the termination
// function as set by std::set_terminate(). Unfortunately, this test is
// very messy, as the gcc exception handling code makes very sure an
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment