signal.cxx (87d2adbc) signal.cxx (747164b0)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 22 unchanged lines hidden (view full) ---

31#include <osl/diagnose.h>
32#include <osl/mutex.h>
33#include <osl/signal.h>
34#ifndef __MINGW32__
35#include <DbgHelp.h>
36#endif
37#include <ErrorRep.h>
38#include <systools/win32/uwinapi.h>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 22 unchanged lines hidden (view full) ---

31#include <osl/diagnose.h>
32#include <osl/mutex.h>
33#include <osl/signal.h>
34#ifndef __MINGW32__
35#include <DbgHelp.h>
36#endif
37#include <ErrorRep.h>
38#include <systools/win32/uwinapi.h>
39#include <eh.h>
40#include <stdexcept>
39
40typedef struct _oslSignalHandlerImpl
41{
42 oslSignalHandlerFunction Handler;
43 void* pData;
44 struct _oslSignalHandlerImpl* pNext;
45} oslSignalHandlerImpl;
46

--- 371 unchanged lines hidden (view full) ---

418 osl_releaseMutex(SignalListMutex);
419
420 return (Action);
421}
422
423/*****************************************************************************/
424/* osl_setErrorReporting */
425/*****************************************************************************/
41
42typedef struct _oslSignalHandlerImpl
43{
44 oslSignalHandlerFunction Handler;
45 void* pData;
46 struct _oslSignalHandlerImpl* pNext;
47} oslSignalHandlerImpl;
48

--- 371 unchanged lines hidden (view full) ---

420 osl_releaseMutex(SignalListMutex);
421
422 return (Action);
423}
424
425/*****************************************************************************/
426/* osl_setErrorReporting */
427/*****************************************************************************/
428
429void win_seh_translator( unsigned nSEHCode, _EXCEPTION_POINTERS* pExcPtrs)
430{
431 const char* pSEHName = NULL;
432 switch( nSEHCode) {
433 case EXCEPTION_ACCESS_VIOLATION: pSEHName = "SEH Exception: ACCESS VIOLATION"; break;
434 case EXCEPTION_DATATYPE_MISALIGNMENT: pSEHName = "SEH Exception: DATATYPE MISALIGNMENT"; break;
435// case EXCEPTION_BREAKPOINT: pSEHName = "SEH Exception: BREAKPOINT"; break;
436// case EXCEPTION_SINGLE_STEP: pSEHName = "SEH Exception: SINGLE STEP"; break;
437 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: pSEHName = "SEH Exception: ARRAY BOUNDS EXCEEDED"; break;
438 case EXCEPTION_FLT_DENORMAL_OPERAND: pSEHName = "SEH Exception: DENORMAL FLOAT OPERAND"; break;
439 case EXCEPTION_FLT_DIVIDE_BY_ZERO: pSEHName = "SEH Exception: FLOAT DIVIDE_BY_ZERO"; break;
440 case EXCEPTION_FLT_INEXACT_RESULT: pSEHName = "SEH Exception: FLOAT INEXACT RESULT"; break;
441 case EXCEPTION_FLT_INVALID_OPERATION: pSEHName = "SEH Exception: INVALID FLOAT OPERATION"; break;
442 case EXCEPTION_FLT_OVERFLOW: pSEHName = "SEH Exception: FLOAT OVERFLOW"; break;
443 case EXCEPTION_FLT_STACK_CHECK: pSEHName = "SEH Exception: FLOAT STACK_CHECK"; break;
444 case EXCEPTION_FLT_UNDERFLOW: pSEHName = "SEH Exception: FLOAT UNDERFLOW"; break;
445 case EXCEPTION_INT_DIVIDE_BY_ZERO: pSEHName = "SEH Exception: INTEGER DIVIDE_BY_ZERO"; break;
446 case EXCEPTION_INT_OVERFLOW: pSEHName = "SEH Exception: INTEGER OVERFLOW"; break;
447 case EXCEPTION_PRIV_INSTRUCTION: pSEHName = "SEH Exception: PRIVILEDGED INSTRUCTION"; break;
448 case EXCEPTION_IN_PAGE_ERROR: pSEHName = "SEH Exception: IN_PAGE_ERROR"; break;
449 case EXCEPTION_ILLEGAL_INSTRUCTION: pSEHName = "SEH Exception: ILLEGAL INSTRUCTION"; break;
450 case EXCEPTION_NONCONTINUABLE_EXCEPTION: pSEHName = "SEH Exception: NONCONTINUABLE EXCEPTION"; break;
451 case EXCEPTION_STACK_OVERFLOW: pSEHName = "SEH Exception: STACK OVERFLOW"; break;
452 case EXCEPTION_INVALID_DISPOSITION: pSEHName = "SEH Exception: INVALID DISPOSITION"; break;
453 case EXCEPTION_GUARD_PAGE: pSEHName = "SEH Exception: GUARD PAGE"; break;
454 case EXCEPTION_INVALID_HANDLE: pSEHName = "SEH Exception: INVALID HANDLE"; break;
455// case EXCEPTION_POSSIBLE_DEADLOCK: pSEHName = "SEH Exception: POSSIBLE DEADLOCK"; break;
456 default: pSEHName = "Unknown SEH Exception"; break;
457 }
458 throw std::runtime_error( pSEHName);
459}
460
426sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable )
427{
428 sal_Bool bOld = bErrorReportingEnabled;
429 bErrorReportingEnabled = bEnable;
430
461sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable )
462{
463 sal_Bool bOld = bErrorReportingEnabled;
464 bErrorReportingEnabled = bEnable;
465
466 if( !bEnable) // if the crash reporter is disabled
467 {
468 // fall back to handle Window's SEH events as C++ exceptions
469 _set_se_translator( win_seh_translator);
470 }
471
431 return bOld;
432}
472 return bOld;
473}