seh

SEH Equivalent in Linux or How do I handle OS Signals (like SIGSERV) and yet keep continuing

与世无争的帅哥 提交于 2019-12-03 20:50:14
问题 I am currently working on a Unit Testing framework where users can create Test Cases and register with the framework. I would also like to ensure that if any of the User Test Code causes a Crash, it should not Crash the entire framework but should be flagged as failed. To Make this work, I wrote up the following Code so that I can run the Users Code within the Sandbox function bool SandBox(void *(*fn)(void *),void *arg, void *rc) { #ifdef WIN32 __try { if (rc) rc = fn(arg); else fn(arg);

intermixing c++ exception handling and SEH (windows)

青春壹個敷衍的年華 提交于 2019-12-03 09:03:46
I have a function in which I call getaddrinfo() to get an sockaddr* which targets memory is allocated by the system. As many may know, you need to call freeaddrinfo() to free the memory allocated by getaddrinfo(). Now, in my function, there are a few places, where I may throw an exception, because some function failed. My first solution was to incorporate the freeaddrinfo() into every if-block. But that did look ugly for me, because I would have had to call it anyways before my function returns, so I came up with SEH`s try-finally... But the problem I encountered is, that it is not allowed to

Under what conditions do I need to set up SEH unwind info for an x86-64 assembly function?

谁都会走 提交于 2019-11-30 20:44:47
The 64-bit Windows ABI defines a generalized exception handling mechanism , which I believe is shared across C++ exceptions and structured exceptions available even in other languages such as C. If I'm writing an x86-64 assembly routine to be compiled in nasm and linked into a C or C++ library, what accommodations do I need make on Windows in terms of generating unwind info and so on? I'm not planning on generating any exceptions directly in the assembly code, although I suppose it is possible that the code may get an access violation if a user-supplied buffer is invalid, etc. I'd like the

SEH Equivalent in Linux or How do I handle OS Signals (like SIGSERV) and yet keep continuing

 ̄綄美尐妖づ 提交于 2019-11-30 19:08:55
I am currently working on a Unit Testing framework where users can create Test Cases and register with the framework. I would also like to ensure that if any of the User Test Code causes a Crash, it should not Crash the entire framework but should be flagged as failed. To Make this work, I wrote up the following Code so that I can run the Users Code within the Sandbox function bool SandBox(void *(*fn)(void *),void *arg, void *rc) { #ifdef WIN32 __try { if (rc) rc = fn(arg); else fn(arg); return true; } __except (EXCEPTION_EXECUTE_HANDLER) { return false; } #else #endif } This works perfectly

Under what conditions do I need to set up SEH unwind info for an x86-64 assembly function?

馋奶兔 提交于 2019-11-30 04:55:07
问题 The 64-bit Windows ABI defines a generalized exception handling mechanism, which I believe is shared across C++ exceptions and structured exceptions available even in other languages such as C. If I'm writing an x86-64 assembly routine to be compiled in nasm and linked into a C or C++ library, what accommodations do I need make on Windows in terms of generating unwind info and so on? I'm not planning on generating any exceptions directly in the assembly code, although I suppose it is possible

Is ARM (not Thumb) supported on WinPhone8 at all?

被刻印的时光 ゝ 提交于 2019-11-29 17:44:10
I'm facing a weird issue, somewhat similar to this . I have a Windows Phone 8 native DLL project, mostly C++ but with an ARM assembly source in it. The source is in ARM mode (i. e. not Thumb). C++ is compiled to Thumb. The app crashes when C++ tries to call into an assembly routine. The call command in the disassembly is BLX with an immediate offset - it's supposed to switch mode back to ARM, unconditionally, but somehow it doesn't. I have the details of the exception. The exception code is 0xc000001d (invalid operation), and the value of the PC in the crash context struct is 0x696d5985. That

Visual C++ Unmanaged Code: Use /EHa or /EHsc for C++ exceptions?

自古美人都是妖i 提交于 2019-11-28 19:34:25
If I'm creating a new project in unmanaged C++, Visual Studio 2008 or greater, which exception handling model do I want to go with? I understand that /EHa option results in less efficient code, and also catches SEH exceptions, right? So I have been steering clear of that option and typically going with /EHsc, so that I'm only catching C++ exceptions that are actually thrown and not catching access violations and other structured execptions, in catch(...) handlers. If there is an access violation in my code, I don't want it being masked by a catch(...) {}. I code with others who want catch(...)

C++ try-catch block doesn't catch hardware exception

醉酒当歌 提交于 2019-11-28 04:47:58
问题 I'm examining hardware and software exceptions in visual studio 2013. I know that I can catch hardware exceptions by setting 'Enable C++ Exceptions' option to /EHa (Yes with SEH Exceptions). I'm trying to catch the following exceptions: EXCEPTION_ARRAY_BOUNDS_EXCEEDED - didn't catch EXCEPTION_ACCESS_VIOLATION - caught EXCEPTION_INT_OVERFLOW - didn't catch EXCEPTION_INT_DIVIDE_BY_ZERO - caught This is an example of code. try { a = std::numeric_limits<int>::max(); a += 5; } catch (...){ std:

What should I know about Structured Exceptions (SEH) in C++?

半世苍凉 提交于 2019-11-27 11:02:10
What important points about Structured Exceptions should every C++ developer know? They are the Win32 equivalent to Unix signals, and let you catch CPU exceptions such as access violation, illegal instruction, divide by zero. With the right compiler options (/EHa for Visual C++), C++ exceptions use the same mechanism as stack unwinding works properly for both C++ (user) exceptions and SEH (OS) exceptions. Unlike C++ exceptions, SEH are not typed but all share the same data structure which has an exception code (the cause) and additional information on what code faulted and what the CPU

What should I know about Structured Exceptions (SEH) in C++?

随声附和 提交于 2019-11-26 15:23:50
问题 What important points about Structured Exceptions should every C++ developer know? 回答1: They are the Win32 equivalent to Unix signals, and let you catch CPU exceptions such as access violation, illegal instruction, divide by zero. With the right compiler options (/EHa for Visual C++), C++ exceptions use the same mechanism as stack unwinding works properly for both C++ (user) exceptions and SEH (OS) exceptions. Unlike C++ exceptions, SEH are not typed but all share the same data structure