add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
endif(FEATURE_MERGE_JIT_AND_ENGINE)
add_definitions(-DFEATURE_MULTICOREJIT)
-if (FEATURE_NI_BIND_FALLBACK)
- add_definitions(-DFEATURE_NI_BIND_FALLBACK)
-endif(FEATURE_NI_BIND_FALLBACK)
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_PAL)
- add_definitions(-DFEATURE_PAL_SXS)
add_definitions(-DFEATURE_PAL_ANSI)
endif(CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD)
sCoreLib = sCoreLibDir;
sCoreLib.Append(CoreLibName_IL_W);
BOOL fExplicitBindToNativeImage = (fBindToNativeImage == true)? TRUE:FALSE;
-#ifdef FEATURE_NI_BIND_FALLBACK
- // Some non-Windows platforms do not automatically generate the NI image as CoreLib.dll.
- // If those platforms also do not support automatic fallback from NI to IL, bind as IL.
- fExplicitBindToNativeImage = FALSE;
-#endif // FEATURE_NI_BIND_FALLBACK
IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib,
TRUE /* fIsInGAC */,
fExplicitBindToNativeImage,
}
#endif
- #ifdef FEATURE_PAL
- PAL_InitializeDebug();
- #endif // FEATURE_PAL
-
// Lazily initialize the interop-safe heap
// Must be done before the RC thread is initialized.
#endif // !_MSC_VER
#endif // !THROW_DECL
-#ifndef _MSC_VER
-#if defined(CORECLR)
-// Define this if the underlying platform supports true 2-pass EH.
-// At the same time, this enables running several PAL instances
-// side-by-side.
-#define FEATURE_PAL_SXS 1
-#endif // CORECLR
-#endif // !_MSC_VER
-
#if defined(_MSC_VER)
#define DECLSPEC_ALIGN(x) __declspec(align(x))
#else
PAL_InitializeCoreCLR(
const char *szExePath);
-PALIMPORT
-DWORD_PTR
-PALAPI
-PAL_EntryPoint(
- IN LPTHREAD_START_ROUTINE lpStartAddress,
- IN LPVOID lpParameter);
-
/// <summary>
/// This function shuts down PAL WITHOUT exiting the current process.
/// </summary>
IN const char *applicationGroupId,
IN const char *suffix);
-PALIMPORT
-void
-PALAPI
-PAL_InitializeDebug(
- void);
-
PALIMPORT
void
PALAPI
#define EXCEPTION_NONCONTINUABLE 0x1
#define EXCEPTION_UNWINDING 0x2
-#ifdef FEATURE_PAL_SXS
-
#define EXCEPTION_EXIT_UNWIND 0x4 // Exit unwind is in progress (not used by PAL SEH)
#define EXCEPTION_NESTED_CALL 0x10 // Nested exception handler call
#define EXCEPTION_TARGET_UNWIND 0x20 // Target unwind in progress
#define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
#define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
-#endif // FEATURE_PAL_SXS
-
#define EXCEPTION_IS_SIGNAL 0x100
#define EXCEPTION_MAXIMUM_PARAMETERS 15
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
-#ifdef FEATURE_PAL_SXS
-
typedef LONG EXCEPTION_DISPOSITION;
enum {
ExceptionCollidedUnwind,
};
-#endif // FEATURE_PAL_SXS
-
//
// A function table entry is generated for each frame function.
//
PAL_nanosleep(
IN long timeInNs);
-#ifndef FEATURE_PAL_SXS
-
-typedef LONG (PALAPI_NOEXPORT *PTOP_LEVEL_EXCEPTION_FILTER)(
- struct _EXCEPTION_POINTERS *ExceptionInfo);
-typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
-
-PALIMPORT
-LPTOP_LEVEL_EXCEPTION_FILTER
-PALAPI
-SetUnhandledExceptionFilter(
- IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
-
-#else // FEATURE_PAL_SXS
-
typedef EXCEPTION_DISPOSITION (PALAPI_NOEXPORT *PVECTORED_EXCEPTION_HANDLER)(
struct _EXCEPTION_POINTERS *ExceptionPointers);
-#endif // FEATURE_PAL_SXS
-
// Define BitScanForward64 and BitScanForward
// Per MSDN, BitScanForward64 will search the mask data from LSB to MSB for a set bit.
// If one is found, its bit position is stored in the out PDWORD argument and 1 is returned;
PALIMPORT time_t __cdecl time(time_t *);
-struct tm {
- int tm_sec; /* seconds after the minute - [0,59] */
- int tm_min; /* minutes after the hour - [0,59] */
- int tm_hour; /* hours since midnight - [0,23] */
- int tm_mday; /* day of the month - [1,31] */
- int tm_mon; /* months since January - [0,11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday - [0,6] */
- int tm_yday; /* days since January 1 - [0,365] */
- int tm_isdst; /* daylight savings time flag */
- };
-
#endif // !PAL_STDCPP_COMPAT
PALIMPORT int __cdecl _open_osfhandle(INT_PTR, int);
#define HardwareExceptionHolder
#endif // FEATURE_ENABLE_HARDWARE_EXCEPTIONS
-#ifdef FEATURE_PAL_SXS
-
class NativeExceptionHolderBase;
PALIMPORT
} // extern "C++"
-#endif // FEATURE_PAL_SXS
-
#define PAL_CPP_THROW(type, obj) { throw obj; }
#define PAL_CPP_RETHROW { throw; }
#define PAL_CPP_TRY try { HardwareExceptionHolder
#pragma warning(disable:4611) // interaction between '_setjmp' and C++ object destruction is non-portable
#endif
-#ifdef FEATURE_PAL_SXS
-
#define PAL_TRY_FOR_DLLMAIN(ParamType, paramDef, paramRef, _reason) PAL_TRY(ParamType, paramDef, paramRef)
-#else // FEATURE_PAL_SXS
-
-#define PAL_TRY(ParamType, paramDef, paramRef) \
- { \
- ParamType __param = paramRef; \
- ParamType paramDef; paramDef = __param; \
- try { \
- HardwareExceptionHolder
-
-#define PAL_TRY_FOR_DLLMAIN(ParamType, paramDef, paramRef, _reason) \
- { \
- ParamType __param = paramRef; \
- ParamType paramDef; paramDef = __param; \
- try { \
- HardwareExceptionHolder
-
-#define PAL_ENDTRY \
- } \
- }
-
-#endif // FEATURE_PAL_SXS
-
#endif // __cplusplus
// Platform-specific library naming
#ifndef __PAL_UNWIND_H__
#define __PAL_UNWIND_H__
-#if FEATURE_PAL_SXS
-
#ifdef __cplusplus
extern "C"
{
};
#endif // __cplusplus
-#endif // FEATURE_PAL_SXS
-
#endif // __PAL_UNWIND_H__
#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME \
"OutOfProcessFunctionTableCallback"
-#if defined(FEATURE_PAL_SXS)
-
// #if !defined(_TARGET_MAC64)
// typedef LONG (*PEXCEPTION_ROUTINE)(
// IN PEXCEPTION_POINTERS pExceptionPointers,
#define ExceptionStackUnwind EXCEPTION_EXECUTE_HANDLER
#define ExceptionContinueExecution EXCEPTION_CONTINUE_EXECUTION
-#endif // FEATURE_PAL_SXS
-
typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD;
typedef EXCEPTION_REGISTRATION_RECORD *PEXCEPTION_REGISTRATION_RECORD;
// The port we use to handle exceptions and to set the thread context
mach_port_t s_ExceptionPort;
-static BOOL s_DebugInitialized = FALSE;
-
static DWORD s_PalInitializeFlags = 0;
static const char * PAL_MACH_EXCEPTION_MODE = "PAL_MachExceptionMode";
}
if (!(exMode & MachException_SuppressDebugging) && (s_PalInitializeFlags & PAL_INITIALIZE_DEBUGGER_EXCEPTIONS))
{
-#ifdef FEATURE_PAL_SXS
// Always hook exception ports for breakpoint exceptions.
// The reason is that we don't know when a managed debugger
// will attach, so we have to be prepared. We don't want
// ports for exactly those threads that currently are in
// this PAL.
machExceptionMask |= PAL_EXC_DEBUGGING_MASK;
-#else // FEATURE_PAL_SXS
- if (s_DebugInitialized)
- {
- machExceptionMask |= PAL_EXC_DEBUGGING_MASK;
- }
-#endif // FEATURE_PAL_SXS
}
if (!(exMode & MachException_SuppressManaged))
{
return machExceptionMask;
}
-#ifdef FEATURE_PAL_SXS
-
/*++
Function :
CPalThread::EnableMachExceptions
return palError;
}
-#else // FEATURE_PAL_SXS
-
-/*++
-Function :
- SEHEnableMachExceptions
-
- Enable SEH-related stuff related to mach exceptions
-
- (no parameters)
-
-Return value :
- TRUE if enabling succeeded
- FALSE otherwise
---*/
-BOOL SEHEnableMachExceptions()
-{
- exception_mask_t machExceptionMask = GetExceptionMask();
- if (machExceptionMask != 0)
- {
- kern_return_t MachRet;
- MachRet = task_set_exception_ports(mach_task_self(),
- machExceptionMask,
- s_ExceptionPort,
- EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE);
-
- if (MachRet != KERN_SUCCESS)
- {
- ASSERT("task_set_exception_ports failed: %d\n", MachRet);
- UTIL_SetLastErrorFromMach(MachRet);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/*++
-Function :
- SEHDisableMachExceptions
-
- Disable SEH-related stuff related to mach exceptions
-
- (no parameters)
-
-Return value :
- TRUE if enabling succeeded
- FALSE otherwise
---*/
-BOOL SEHDisableMachExceptions()
-{
- exception_mask_t machExceptionMask = GetExceptionMask();
- if (machExceptionMask != 0)
- {
- kern_return_t MachRet;
- MachRet = task_set_exception_ports(mach_task_self(),
- machExceptionMask,
- MACH_PORT_NULL,
- EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE);
-
- if (MachRet != KERN_SUCCESS)
- {
- ASSERT("task_set_exception_ports failed: %d\n", MachRet);
- UTIL_SetLastErrorFromMach(MachRet);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-#endif // FEATURE_PAL_SXS
-
#if !defined(_AMD64_)
extern "C"
void PAL_DispatchException(PCONTEXT pContext, PEXCEPTION_RECORD pExRecord, MachExceptionInfo *pMachExceptionInfo)
Entry point for the thread that will listen for exception in any other thread.
-#ifdef FEATURE_PAL_SXS
NOTE: This thread is not a PAL thread, and it must not be one. If it was,
exceptions on this thread would be delivered to the port this thread itself
is listening on.
This means: no printf, no TRACE, no PAL allocation, no ExitProcess,
no LastError in this function and its helpers. To report fatal failure,
use NONPAL_RETAIL_ASSERT.
-#endif // FEATURE_PAL_SXS
Parameters :
void *args - not used
}
}
#endif // _DEBUG
-
-#ifndef FEATURE_PAL_SXS
- if (!SEHEnableMachExceptions())
- {
- return FALSE;
- }
-#endif // !FEATURE_PAL_SXS
}
// Tell the system to ignore SIGPIPE signals rather than use the default
return TRUE;
}
-/*++
-Function :
- MachExceptionInitializeDebug
-
- Initialize the mach exception handlers necessary for a managed debugger
- to work
-
-Return value :
- None
---*/
-void MachExceptionInitializeDebug(void)
-{
- if (s_DebugInitialized == FALSE)
- {
-#ifndef FEATURE_PAL_SXS
- kern_return_t MachRet;
- MachRet = task_set_exception_ports(mach_task_self(),
- PAL_EXC_DEBUGGING_MASK,
- s_ExceptionPort,
- EXCEPTION_DEFAULT,
- MACHINE_THREAD_STATE);
- if (MachRet != KERN_SUCCESS)
- {
- ASSERT("task_set_exception_ports failed: %d\n", MachRet);
- TerminateProcess(GetCurrentProcess(), (UINT)(-1));
- }
-#endif // !FEATURE_PAL_SXS
- s_DebugInitialized = TRUE;
- }
-}
-
-/*++
-Function :
- SEHCleanupExceptionPort
-
- Restore default exception port handler
-
- (no parameters, no return value)
-
-Note :
-During PAL_Terminate, we reach a point where SEH isn't possible any more
-(handle manager is off, etc). Past that point, we can't avoid crashing on
-an exception.
---*/
-void
-SEHCleanupExceptionPort(void)
-{
- TRACE("Restoring default exception ports\n");
-#ifndef FEATURE_PAL_SXS
- SEHDisableMachExceptions();
-#endif // !FEATURE_PAL_SXS
- s_DebugInitialized = FALSE;
-}
-
extern "C"
void
ActivationHandler(CONTEXT* context)
// Process and thread initialization/cleanup/context routines
BOOL SEHInitializeMachExceptions(DWORD flags);
-void SEHCleanupExceptionPort (void);
void MachExceptionInitializeDebug(void);
PAL_NORETURN void MachSetThreadContext(CONTEXT *lpContext);
--*/
-#ifndef FEATURE_PAL_SXS
-#error FEATURE_PAL_SXS needs to be defined for this file.
-#endif // !FEATURE_PAL_SXS
-
#include "pal/context.h"
#include "pal.h"
#include <dlfcn.h>
{
TRACE("Cleaning up SEH\n");
-#if HAVE_MACH_EXCEPTIONS
- SEHCleanupExceptionPort();
-#endif
SEHCleanupSignals();
}
DCI_POLL,
DCI_CRYPT,
DCI_SHFOLDER,
-#ifdef FEATURE_PAL_SXS
DCI_SXS,
-#endif // FEATURE_PAL_SXS
DCI_NUMA,
// Please make sure to update dbg_channel_names when adding entries here.
#define srand DUMMY_srand
#define atoi DUMMY_atoi
#define atof DUMMY_atof
-#define tm PAL_tm
#define size_t DUMMY_size_t
#define time_t PAL_time_t
#define va_list DUMMY_va_list
#undef qsort
#undef bsearch
#undef time
-#undef tm
#undef FILE
#undef fclose
#undef fopen
extern "C"
{
-#ifdef FEATURE_PAL_SXS
/*++
Function :
SEHEnable
--*/
CorUnix::PAL_ERROR SEHDisable(CorUnix::CPalThread *pthrCurrent);
-#endif // FEATURE_PAL_SXS
-
}
#endif /* _PAL_SEH_HPP_ */
OUT LPFILETIME lpKernelTime,
OUT LPFILETIME lpUserTime);
-#ifdef FEATURE_PAL_SXS
#if HAVE_MACH_EXCEPTIONS
// Structure used to return data about a single handler to a caller.
int GetIndexOfHandler(exception_mask_t bmExceptionMask);
};
#endif // HAVE_MACH_EXCEPTIONS
-#endif // FEATURE_PAL_SXS
class CThreadCRTInfo : public CThreadInfoInitializer
{
//
static void* ThreadEntry(void * pvParam);
-
-#ifdef FEATURE_PAL_SXS
+
//
// Data for PAL side-by-side support
//
// specific handlers.
CThreadMachExceptionHandlers m_sMachExceptionHandlers;
#endif // HAVE_MACH_EXCEPTIONS
-#endif // FEATURE_PAL_SXS
public:
#endif // HAVE_MACH_EXCEPTIONS
};
-#if defined(FEATURE_PAL_SXS)
extern "C" CPalThread *CreateCurrentThreadData();
-#endif // FEATURE_PAL_SXS
inline CPalThread *GetCurrentPalThread()
{
inline CPalThread *InternalGetCurrentThread()
{
CPalThread *pThread = GetCurrentPalThread();
-#if defined(FEATURE_PAL_SXS)
if (pThread == nullptr)
pThread = CreateCurrentThreadData();
-#endif // FEATURE_PAL_SXS
return pThread;
}
#endif
}
-/*++
-Function:
- PAL_EntryPoint
-
-Abstract:
- This function should be used to wrap code that uses PAL library on thread that was not created by PAL.
---*/
-PALIMPORT
-DWORD_PTR
-PALAPI
-PAL_EntryPoint(
- IN LPTHREAD_START_ROUTINE lpStartAddress,
- IN LPVOID lpParameter)
-{
- CPalThread *pThread;
- DWORD_PTR retval = (DWORD) -1;
-
- ENTRY("PAL_EntryPoint(lpStartAddress=%p, lpParameter=%p)\n", lpStartAddress, lpParameter);
-
- pThread = InternalGetCurrentThread();
- if (NULL == pThread)
- {
- /* This function works only for thread that called PAL_Initialize for now. */
- ERROR( "Unable to get the thread object.\n" );
- goto done;
- }
-
- retval = (*lpStartAddress)(lpParameter);
-
-done:
- LOGEXIT("PAL_EntryPoint returns int %d\n", retval);
- return retval;
-}
-
/*++
Function:
PAL_Shutdown
exit(exitCode);
}
-/*++
-Function:
- PAL_InitializeDebug
-
-Abstract:
- This function is the called when cordbg attaches to the process.
---*/
-void
-PALAPI
-PAL_InitializeDebug(
- void)
-{
- PERF_ENTRY(PAL_InitializeDebug);
- ENTRY("PAL_InitializeDebug()\n");
-#if HAVE_MACH_EXCEPTIONS
- MachExceptionInitializeDebug();
-#endif
- LOGEXIT("PAL_InitializeDebug returns\n");
- PERF_EXIT(PAL_InitializeDebug);
-}
-
/*++
Function:
PALIsThreadDataInitialized
using namespace CorUnix;
-#ifdef FEATURE_PAL_SXS
-
SET_DEFAULT_DEBUG_CHANNEL(SXS);
PAL_ERROR AllocatePalThread(CPalThread **ppThread);
*ppThread = pThread;
return palError;
}
-
-#endif // FEATURE_PAL_SXS
"POLL",
"CRYPT",
"SHFOLDER"
-#ifdef FEATURE_PAL_SXS
, "SXS"
-#endif // FEATURE_PAL_SXS
, "DCI_NUMA"
};
}
-#ifdef FEATURE_PAL_SXS
static const void *DBG_get_module_id()
{
static const void *s_module_id = NULL;
#define MODULE_ID DBG_get_module_id,
#define MODULE_FORMAT "-%p"
-#else
-#define MODULE_ID
-#define MODULE_FORMAT
-#endif // FEATURE_PAL_SXS
/*++
Function :
extern __time32_t __cdecl __loctotime32_t(int, int, int, int, int, int, int);
extern __time64_t __cdecl __loctotime64_t(int, int, int, int, int, int, int);
-#ifdef _TM_DEFINED
-extern int __cdecl _isindst(__in struct tm * _Time);
-#endif /* _TM_DEFINED */
-
extern void __cdecl __tzset(void);
extern int __cdecl _validdrive(unsigned);
#define IS_LEAP_YEAR(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0)
-/*
- * get the buffer used by gmtime
- */
-struct tm * __cdecl __getgmtimebuf ();
-
/*
* This variable is in the C start-up; the length must be kept synchronized
* It is used by the *cenvarg.c modules
if (dwProcessId == GetCurrentProcessId())
{
-#ifdef FEATURE_PAL_SXS
// Need to implement SetThreadContext(current thread) for the IX architecture; look at common_signal_handler.
_ASSERT(FALSE);
-#endif // FEATURE_PAL_SXS
+
ASSERT("SetThreadContext should be called for cross-process only.\n");
SetLastError(ERROR_INVALID_PARAMETER);
goto EXIT;
ASSERT("Unable to obtain state controller for thread");
}
-#ifndef FEATURE_PAL_SXS
- // If this is the last thread then delete the process' data,
- // but don't exit because the application hosting the PAL
- // might have its own threads.
- if (PROCGetNumberOfThreads() == 1)
- {
- TRACE("Last thread is exiting\n");
- TerminateCurrentProcessNoExit(FALSE);
- }
- else
-#endif // !FEATURE_PAL_SXS
- {
- /* Do this ONLY if we aren't the last thread -> otherwise
- it gets done by TerminateProcess->
- PROCCleanupProcess->PALShutdown->PAL_Terminate */
-
- //
- // Add a reference to the thread data before releasing the
- // thread object, so we can still use it
- //
+ //
+ // Add a reference to the thread data before releasing the
+ // thread object, so we can still use it
+ //
- pThread->AddThreadReference();
+ pThread->AddThreadReference();
- //
- // Release the reference to the IPalObject for this thread
- //
-
- pThread->GetThreadObject()->ReleaseReference(pThread);
+ //
+ // Release the reference to the IPalObject for this thread
+ //
- /* Remove thread for the thread list of the process
- (don't do if this is the last thread -> gets handled by
- TerminateProcess->PROCCleanupProcess->PROCTerminateOtherThreads) */
+ pThread->GetThreadObject()->ReleaseReference(pThread);
- PROCRemoveThread(pThread, pThread);
+ /* Remove thread for the thread list of the process
+ (don't do if this is the last thread -> gets handled by
+ TerminateProcess->PROCCleanupProcess->PROCTerminateOtherThreads) */
-#ifdef FEATURE_PAL_SXS
- // Ensure that EH is disabled on the current thread
- SEHDisable(pThread);
-#endif // FEATURE_PAL_SXS
+ PROCRemoveThread(pThread, pThread);
+ // Ensure that EH is disabled on the current thread
+ SEHDisable(pThread);
- //
- // Now release our reference to the thread data. We cannot touch
- // it after this point
- //
+ //
+ // Now release our reference to the thread data. We cannot touch
+ // it after this point
+ //
- pThread->ReleaseThreadReference();
- }
+ pThread->ReleaseThreadReference();
}
/*++
goto RunPostCreateInitializersExit;
}
-#ifdef FEATURE_PAL_SXS
palError = SEHEnable(this);
if (NO_ERROR != palError)
{
goto RunPostCreateInitializersExit;
}
-#endif // FEATURE_PAL_SXS
RunPostCreateInitializersExit:
#add_subdirectory(PAL_TRY_EXCEPT_EX)
#add_subdirectory(PAL_TRY_LEAVE_FINALLY)
add_subdirectory(RaiseException)
-#add_subdirectory(SetUnhandledExceptionFilter)
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_setunhandledexceptionfilter_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_setunhandledexceptionfilter_test1 coreclrpal)
-
-target_link_libraries(paltest_setunhandledexceptionfilter_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=============================================================
-**
-** Source: test1.c
-**
-** Purpose: Sets up a new unhandled exception filter, and makes sure it
-** returns the previous filter. Raises an unhandled exception and
-** makes sure this reaches the filter.
-**
-**
-**============================================================*/
-
-
-#include <palsuite.h>
-
-/* This isn't defined in the pal, so copied from win32 */
-#define EXCEPTION_EXECUTE_HANDLER 1
-#define EXCEPTION_CONTINUE_EXECUTION -1
-
-
-int InFilter = FALSE;
-
-LONG PALAPI FirstFilter(LPEXCEPTION_POINTERS p)
-{
- return EXCEPTION_EXECUTE_HANDLER;
-}
-
-LONG PALAPI ContinueFilter(LPEXCEPTION_POINTERS p)
-{
- InFilter = TRUE;
-
- Trace("This test has succeeded as far at the automated checks can "
- "tell. Manual verification is now required to be completely sure.\n");
- Trace("Now the PAL's handling of application errors will be tested "
- "with an exception code of %u.\n",
- p->ExceptionRecord->ExceptionCode);
- Trace("Please verify that the actions that the PAL now takes are "
- "as specified for it.\n");
-
- return EXCEPTION_CONTINUE_SEARCH;
-}
-
-int __cdecl main(int argc, char *argv[])
-{
- LPTOP_LEVEL_EXCEPTION_FILTER OldFilter;
-
- if(0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
-
- SetUnhandledExceptionFilter(FirstFilter);
-
- OldFilter = SetUnhandledExceptionFilter(ContinueFilter);
- if (OldFilter != FirstFilter)
- {
- Fail("SetUnhandledExceptionFilter did not return a pointer to the "
- "previous filter!\n");
- }
-
- /*
- * Raise an unhandled exception. This should cause our filter to be
- * excecuted and the program to exit with a code the same as the
- * exception code.
- */
- RaiseException(3,0,0,0);
-
-
- /*
- * This code should not be executed because the toplevelhandler is
- * expected to "just" set the exit code and abend the program
- */
- Fail("An unhandled exception did not cause the program to abend with"
- "the exit code == the ExceptionCode!\n");
-
- PAL_Terminate();
- return FAIL;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = exception_handling
-Function = SetUnhandledExceptionFilter
-Name = SetUnhandledExceptionFilter test #1
-TYPE = DEFAULT
-EXE1 = test1
-LANG = cpp
-Description
-=Sets up a new unhandled exception filter, and makes sure it
-=returns the previous filter. Raises an unhandled exception and
-=makes sure this reaches the filter.
# dialog
debug_api/outputdebugstringw/test1,1
debug_api/outputdebugstringa/test1,1
-# The return code on success is NOT the usual 0, instead it's 3
-exception_handling/setunhandledexceptionfilter/test1,1
# These tests require user intervention and cannot be automated
pal_specific/pal_get_stdin/test1,1
threading/setconsolectrlhandler/test1,1
# add_subdirectory(PAL_get_stdin)
# add_subdirectory(PAL_get_stdout)
-add_subdirectory(pal_entrypoint)
add_subdirectory(PAL_errno)
add_subdirectory(PAL_GetPALDirectoryW)
-add_subdirectory(pal_initializedebug)
add_subdirectory(PAL_Initialize_Terminate)
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- pal_entrypoint.cpp
-)
-
-add_executable(paltest_pal_entrypoint_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_pal_entrypoint_test1 coreclrpal)
-
-target_link_libraries(paltest_pal_entrypoint_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=============================================================
-**
-** Source: pal_entrypoint.c
-**
-** Purpose: Positive test the PAL_EntryPoint API.
-**
-** Test the PAL_EntryPoint, Call a PAL function, and let main return
-** as expected..
-**
-
-**
-**============================================================*/
-
-#include "palstartup.h"
-
-/* Test case copied and stream lined from isalpha\test1*/
-struct testCase
-{
- int CorrectResult;
- int character;
-};
-
-int __cdecl main(int argc, char *argv[])
-{
- int result;
- int i;
-
- struct testCase testCases[] =
- {
- {1, 'a'}
- };
-
-
- i = 0;
- result = isalpha(testCases[i].character);
- /* The return value is 'non-zero' for success. This if condition
- * will still work if that non-zero isn't just 1
- */
- if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
- ( (testCases[i].CorrectResult == 0) && (result != 0) ))
- {
- Fail("ERROR: isalpha returned %i instead of %i for character "
- "%c.\n",
- result,
- testCases[i].CorrectResult,
- testCases[i].character);
- }
-
- return PASS;
-}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// ===========================================================================
-// File: palstartup.h
-//
-// An implementation of startup code for Rotor's Unix PAL. This file should
-// be included by any file in a PAL application that defines main.
-// we have added palsuite.h to include test related macros etc...
-// ===========================================================================
-
-#ifndef __PALSTARTUP_H__
-#define __PALSTARTUP_H__
-
-#include <palsuite.h>
-
-int __cdecl PAL_startup_main(int argc, char **argv);
-
-struct _mainargs
-{
- int argc;
- char ** argv;
-};
-
-static DWORD run_main(struct _mainargs *args)
-{
- return (DWORD) PAL_startup_main(args->argc, args->argv);
-}
-
-static void terminate(void)
-{
- PAL_Terminate();
-}
-
-int __cdecl main(int argc, char **argv) {
- struct _mainargs mainargs;
-
- if (PAL_Initialize(argc, argv)) {
- return FAIL;;
- }
-
- atexit(terminate);
-
- mainargs.argc = argc;
- mainargs.argv = argv;
- exit((int)PAL_EntryPoint((PTHREAD_START_ROUTINE)run_main, &mainargs));
- return 0; // Quiet a compiler warning
-}
-
-#define main PAL_startup_main
-
-#endif // __PALSTARTUP_H__
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = PAL_Specific
-Function = PAL_entrypoint
-Name = Positive test entrypoint API
-TYPE = DEFAULT
-EXE1 = pal_errno
-Description
-=Test the PAL_entrypoint to call a PAL api
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- pal_initializedebug.cpp
-)
-
-add_executable(paltest_pal_initializedebug_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_pal_initializedebug_test1 coreclrpal)
-
-target_link_libraries(paltest_pal_initializedebug_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=============================================================
-**
-** Source: pal_initializedebug.c
-**
-** Purpose: Positive test the PAL_InitializeDebug API.
-**
-** Test the PAL_InitializeDebug, it will be NOPs for all
-** platforms other than Mac. There is no other way of testing it
-** currently
-**
-
-**
-**============================================================*/
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
- int err;
-
- /* Initialize the PAL environment */
- err = PAL_Initialize(argc, argv);
-
- if(0 != err)
- {
- return FAIL;
- }
-
- PAL_InitializeDebug();
-
- PAL_Terminate();
- return 0;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = PAL_Specific
-Function = PAL_InitializeDebug
-Name = Positive test for PAL_InitializeDebug
-TYPE = DEFAULT
-EXE1 = pal_initializedebug
-Description
-=Test the PAL_InitializeDebug, it will be NOPs for all
-=platforms other than Mac
miscellaneous/SetEnvironmentVariableW/test4/paltest_setenvironmentvariablew_test4
miscellaneous/SetLastError/test1/paltest_setlasterror_test1
miscellaneous/_i64tow/test1/paltest_i64tow_test1
-pal_specific/pal_entrypoint/test1/paltest_pal_entrypoint_test1
pal_specific/PAL_errno/test1/paltest_pal_errno_test1
-pal_specific/pal_initializedebug/test1/paltest_pal_initializedebug_test1
pal_specific/PAL_Initialize_Terminate/test1/paltest_pal_initialize_terminate_test1
pal_specific/PAL_Initialize_Terminate/test2/paltest_pal_initialize_terminate_test2
samples/test1/paltest_samples_test1
exception_handling/PAL_TRY_EXCEPT_EX/test2/paltest_pal_try_except_ex_test2
exception_handling/PAL_TRY_EXCEPT_EX/test3/paltest_pal_try_except_ex_test3
exception_handling/PAL_TRY_LEAVE_FINALLY/test1/paltest_pal_try_leave_finally_test1
-exception_handling/SetUnhandledExceptionFilter/test1/paltest_setunhandledexceptionfilter_test1
filemapping_memmgt/CreateFileMappingA/test5/paltest_createfilemappinga_test5
filemapping_memmgt/CreateFileMappingA/test6/paltest_createfilemappinga_test6
filemapping_memmgt/CreateFileMappingA/test7/paltest_createfilemappinga_test7