Author Topic: Crash Handler  (Read 4515 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Crash Handler
« on: April 13, 2006, 06:54:35 pm »
What can be more annoying than typing for 15 minutes and then this godforsaken code completion plugin pops up its darn window and the application crashes!
Of course, you didn't think about saving every 30 seconds while you concentrated on coding, so what now?

Here goes:
As of revision 2343, Code::Blocks has a built-in crash handler. At the present time, it is only implemented under Windows XP, but it should not be too hard to add similar functionality under Linux using plain old posix signal handlers.

Note that the crash handler is not compiled into Code::Blocks by default, as it requires functionality specific to Windows XP.

To enable the crash handler, you have to add WINVER=0x0501 to the #defines pane in the project options when building Code::Blocks.

Whenever the application crashes (for whatever reason), all open editors are saved to a recovery folder within your home directory. Of course, due to the nature of a crash, no claims can be made on the integrity of that data, but 99% of the time, you should be OK. :)

Additionally, you can choose whether to have the application terminated the usual way or take the the opportunity to step over the offending instruction, which may actually happen to work and which may allow you to do a graceful shutdown.

Hope you enjoy this little addition (well, those of you who can) :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Crash Handler
« Reply #1 on: April 13, 2006, 07:05:45 pm »
Hello,

An excellent addition :D that can your work (and eventually your head :)). Thank you very much.

I have just a small question. Why did you use specific functionalities of Windows XP instead of a more cross-platform solution?

Best wishes,
Michael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Crash Handler
« Reply #2 on: April 13, 2006, 07:16:52 pm »
I have just a small question. Why did you use specific functionalities of Windows XP instead of a more cross-platform solution?
Windows 95/98/ME/2000/NT have no comparable functionality at all (as far as I know), and even if they did, it would not be portable anyway.

On the other hand, signal handlers work fine on every Posix system, but are not implemented under Windows (they can be emulated using the pthreads library, though).

So, which specific cross-platform implementation do you have in mind?  8)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Crash Handler
« Reply #3 on: April 13, 2006, 07:50:03 pm »
I have just a small question. Why did you use specific functionalities of Windows XP instead of a more cross-platform solution?
Windows 95/98/ME/2000/NT have no comparable functionality at all (as far as I know), and even if they did, it would not be portable anyway.

Ok, I see. The pleasure to work with Windows :).

On the other hand, signal handlers work fine on every Posix system, but are not implemented under Windows (they can be emulated using the pthreads library, though).

Yes, I see. We have briefly discussed some time ago about Win32 pthreads. Is it still unusable?

So, which specific cross-platform implementation do you have in mind?  8)

Difficult question :). If Win32 pthreads would be a valid option, then it could be used.

Time ago, I have found M$ Services for UNIX (SFU) which could be of some interest. But I never tried them as they seems to be more enterprise-oriented.

Anyway, I will give a try to see if I can find a better pthreads library than Win32 pthreads.

Best wishes,
Michael