How to debug application using SetUnhandledExceptionFilter function for exception handling

  • Thread starter Raghunatha Babu
  • Start date
R

Raghunatha Babu

Hi

We are using the API "SetUnhandledExceptionFilter" to handle the exceptions
globally as:

SetUnhandledExceptionFilter(MyUnHandleExceptionFilter);

where the prototype of "MyUnHandleExceptionFilter" is:

LONG WINAPI MyUnHandleExceptionFilter(struct _EXCEPTION_POINTERS
*lpExceptionInfo);

This works fine while running in Debug and Release modes. But while
debugging, it is not handling the exceptions. In MSDN It is mentioned that
this function doesn't support the Debugging.

Ex:
void TestIntegerDivideByZero(int x, int y)
{
try
{
int ix = 0;
int nVal = 0;
int ix = 5 / nVal; //It is not possible to proceed from this statement
while debugging.
_tprintf(_T("Integer By Zero - Result = %d\n"), ix);
++ix;
}
catch (OSException& exception)
{
_tprintf(_T("<Thread - %x> - Exception Code = %x\n"),
GetCurrentThreadId(), exception.getExceptionCode());
}
}
We already know that the SetUnhandledExceptionFilter doesn't handle
exceptions while debugging, because the debugger will catch the exceptions
while debugging. This functionality is implemented in dll and used in other
exe's. To debug other exe's this functionality should not make any
difficulties.

Can any one please let us know how to handle the exceptions while debugging
?

Are there any other APIs with which we can combine the
SetUnhandledExceptionFilter and solve the purpose??

Regards,
Raghunath.
 
P

Phlip

Raghunatha said:
We are using the API "SetUnhandledExceptionFilter" to handle the exceptions
globally as:

Please use http://groups.google.com to search for the best newsgroup for
SetUnhandledExceptionFilter(). This group tries to discuss raw C++.

Also, you might accidentally find the answer...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top