diff options
Diffstat (limited to 'src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp')
-rw-r--r-- | src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp index 614690897a..000ed6271c 100644 --- a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp +++ b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp @@ -20,6 +20,17 @@ int InitializeDllTest1() return PAL_InitializeDLL(); } +__attribute__((noinline,optnone)) +static void FailingFunction(volatile int *p) +{ + if (p == NULL) + { + throw PAL_SEHException(); + } + + *p = 1; // Causes an access violation exception +} + BOOL bTry = FALSE; BOOL bExcept = FALSE; @@ -33,7 +44,8 @@ int DllTest1() volatile int* p = (volatile int *)0x11; // Invalid pointer bTry = TRUE; // Indicate we hit the PAL_TRY block - *p = 1; // Causes an access violation exception + FailingFunction(p); // Throw in function to fool C++ runtime into handling + // h/w exception Fail("ERROR: code was executed after the access violation.\n"); } |