Skip to main content
gamedev.net
🔒 Locked

Crash exceptions?

Started by The C modest god Oct 27, 2005 at 1:31 PM 2 replies 550+ views
Original Post
The C modest god
The C modest god
From what I understood, in windowsXP, before a program crashes it always throws an exception. Unless there is a bug in the OS itself. Anyway, when the crash is the "fault" of the program it would throw an exception. Is there somewhere all the possible exceptions that a program can throw, that are not written explicitly in the code. Meaning, all the possible exceptions that the programer didn't write in his code (didnt write throw something). Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
Kitt3n
Kitt3n
Look in the msdn for "Structured exception handling" and "GetExceptionCode",
or "EXCEPTION_ACCESS_VIOLATION".

Btw, if I remember correctly, you had to switch some compilersettings
to get it to work... and I remember it being a pain in the ass,
because it didn't work with a simple catch (...) block (you couldn't
get the errorcode easily)...

If you have any luck getting a nice & clean solution, keep us posted :)

/R
visit my website at www.kalmiya.com
ApochPiQ
ApochPiQ
In Visual C++ 6.0:

- Start a debugging session (doesn't matter what you debug, just get the IDE into debug mode)
- Click View
- Click Exceptions


In Visual C++ .Net 2003:

- Click Debug (IIRC - one of the top level menus)
- Click Exceptions


This article also shows some more in-depth information on how exception codes are calculated and lists some additional examples of the most common exceptions (in case you don't use VC++). I'm sure there's a complete reference out there someplace, but Google is not being nice to me at the moment.
The C modest god
The C modest god
Quote:
Original post by Kitt3n
Look in the msdn for "Structured exception handling" and "GetExceptionCode",
or "EXCEPTION_ACCESS_VIOLATION".

Btw, if I remember correctly, you had to switch some compilersettings
to get it to work... and I remember it being a pain in the ass,
because it didn't work with a simple catch (...) block (you couldn't
get the errorcode easily)...

If you have any luck getting a nice & clean solution, keep us posted :)

/R

The solution I have found is to use _set_se_translator.
This functions sets a function that translates C exception into whatever exception you wnat, example:
class WindowsError {	public:		PEXCEPTION_POINTERS Ptr;};static void se_translator (unsigned int e, PEXCEPTION_POINTERS p){	WindowsError WinErr;	WinErr.Ptr = p;	throw WinErr;}	_set_se_translator (se_translator);


I found this valuable information in my old book about VisualC++5.

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.