This article gives a good overview on why structured exception handling is bad. Is there a way to get the robustness of stopping your server from crashing, while getting past the problems mentioned in the article?
I have a server software that runs about 400 connected users concurrently. But if there is a crash all 400 users are effec...
I wish to set a usererror string before leaving a function, depending on the return code and variable in the function.
I currently have:
Dim RetVal as RetType
try
...
if ... then
RetVal = RetType.FailedParse
end try
endif
...
finally
select case RetVal
case ...
UserStr = ...
end select
end try
ret...
This question provides more clarity on the problem described here. I did some more investigation and found that the stack unwinding is not happening in the following piece of code:
class One
{
public:
int x ;
};
class Wrapper
{
public:
Wrapper(CString csText):mcsText(csText)
{
CString csTempText;
csTempText.Format...
I've posted a question about validating a pointer's accessibility. The conclusion was either to use IsBadReadPtr to check the pointer, or SEH to catch the exception (and preferably to use neither, and debug the application, but that's not the issue here).
IsBadReadPtr is said to be bad because, among other reasons, it would try to read ...
Is there a way to escape the "one big stack" model of Win32 without crippling SEH? I'd like to be able to allocate stack frames on the heap, as a way to implement coroutines. However, my code is currently depending on SEH, and this article, a few pages down, says (relating to traversal of exception handlers, scanning, emphasis mine):
...
Could someone provide some example on implementing SEH in VB6? Everything I've seen so far is in C++
...
When we use SEH with __finally block,
if we do return in __try block, it causes a local unwind.
To Local unwind, the system need to approximately 1000 instructions.
The local unwind causes a warning C6242. MSDN suggests using __leave keyword(with saving a return value).
But I don't think it's a good idea.
If we use __leave keyword, the...
The following code will give a hard fail when run under Windows 7 32bit:
void CTestView::OnDraw(CDC* /*pDC*/)
{
*(int*)0 = 0; // Crash
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: add draw code for native data here
}
However, if I try this on Windows 7 64bit, I just get ...
What important points about Structured Exceptions should every C++ developer know?
...
#include <windows.h>
int main()
{
int* i = (int*)malloc(sizeof(int));
*i = 5;
__try
{
free(i);
free(i);
}
__except
{
return -1;
}
return 0;
}
I am trying to learn more about windows SEH. My first test program is giving me some real trouble. I have looked at the msdn documenta...
This is mostly curiosity, but I've been reading about the history of Visual Studio catching SEH exceptions in a C++ try-catch construct. I keep running across the assertion that older version Visual Studio with the /GX flag enabled would "somtimes" catch structured Win32 exceptions in a C++ catch block.
Under what circumstances will Vi...
Hi, I'd like to force a coredump from a program (or see its memory at a specific time in some other way). There are a couple of problems though:
I'm running it under wine (cannot run via winedbg, because the application detects it)
The application uses exceptions / SEH / other handlers, which capture non-standard events
Even attaching ...
MSDN describes UnhandledExceptionFilter as follows: "An application-defined function that passes unhandled exceptions to the debugger, if the process is being debugged."
But this function is clearly supplied by the OS, in kernel32.dll according to that same page.
So why do they call it an application-defined function?
...
Can anyone tell me a code for next function, which raises EXCEPTION_FLT_STACK_CHECK or EXCEPTION_BREAKPOINT, for I could catch them in main func:
int _tmain(int argc, _TCHAR* argv[])
{
__try
{
FaultingStack(); // What I need to write in this function???
}
__except(GetExceptionCode() == EXCEPTION_FLT_STACK_CHEC...
Ok, it sounds strange, but I need a sample code, that throws EXCEPTION_FLT_UNDERFLOW. I already have code to handle that exception. Now I need sample, that throws this damn EXCEPTION_FLT_UNDERFLOW. Any advises?
...
This is kinda a very low-level type question, but maybe someone here has some insight...
I'm having an issue where unhandled SEH exceptions (such as Access Violations) are seemingly being caught at the Win32 message dispatch level, rather than terminating the program. I found the following reference blog, which explains the problem, but...