|
-
December 5th, 2007, 10:03 AM
#1
[RESOLVED] rethrow in catch statement
I'm not really used with exception but I'm trying to do something really simple. I searched a little bit around the internet, but found nothing interesting that really answer my question.
In a catch statement, I try to throw an exception:
Code:
void throwException()
{
throw 0;
}
void Foo()
{
try {
throwException();
}
catch (int) {
throw 0;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
try {
Foo();
}
catch (int i) {
}
return 0;
}
And here the callstack I receive at the throw in the catch statement:
msvcr80d.dll!CallCatchBlock(EHExceptionRecord * pExcept=0x0012f918, EHRegistrationNode * pRN=0x0012fe68, _CONTEXT * pContext=0x0012f938, const _s_FuncInfo * pFuncInfo=0x00417bd8, void * handlerAddress=0x004114bf, int CatchDepth=0, unsigned long NLGCode=256) Line 1499 C++
msvcr80d.dll!_NLG_Call() + 0x2 bytes Asm
msvcr80d.dll!@_EH4_LocalUnwind@16() + 0x10 bytes Asm
msvcr80d.dll!_except_handler4_common(unsigned int * CookiePointer=0x10310974, void (unsigned int)* CookieCheckFunction=0x102150b0, _EXCEPTION_RECORD * ExceptionRecord=0x0012f2c4, _EXCEPTION_REGISTRATION_RECORD * EstablisherFrame=0x0012f70c, _CONTEXT * ContextRecord=0x0012ede0, void * DispatcherContext=0x0012edd4) + 0x195 bytes C
msvcr80d.dll!_except_handler4(_EXCEPTION_RECORD * ExceptionRecord=0x0012f2c4, _EXCEPTION_REGISTRATION_RECORD * EstablisherFrame=0x0012f70c, _CONTEXT * ContextRecord=0x0012ede0, void * DispatcherContext=0x0012edd4) + 0x22 bytes C
ntdll.dll!7c9037bf()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!7c90378b()
ntdll.dll!7c937b48()
I don't know if this is valid or not. But if it's not valid, I would like to know why exactly? I use visual C++ 2005 (without service pack) if that has anything to do with the problem.
Thanks in advance.
-
December 5th, 2007, 10:46 AM
#2
Re: rethrow in catch statement
Ok, I found out that the problem occurs when I was tracing only. It seems that when the throw was trying to jump, instead of going directly to the next catch, it was going in that weird callstack.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|