Re: Trapping application "crashes"?
On Wed, Sep 05, 2007 at 11:43:34AM +0300, Marius Vollmer wrote: > "ext Daniel Stone" <[EMAIL PROTECTED]> writes: > > On Tue, Sep 04, 2007 at 11:01:40PM -0700, ext Jayesh Salvi wrote: > >> If you end up registering your signal handlers - do only little in those > >> signal handlers. It's not a good idea to keep executing once you have > >> corrupted memory - you might run into more ugly errors. > > > > Indeed, man signal (at least from glibc) explicitly lists the only calls > > that are safe to run from signal handlers. > > Which is of course a different thing: even if you only use the > signal-safe functions in your handler, you shouldn't ever return from > it and try to continue the program. Of course; I wasn't trying to suggest otherwise. 'Do absolutely bugger all, and then get out.' signature.asc Description: Digital signature ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Trapping application "crashes"?
"ext Daniel Stone" <[EMAIL PROTECTED]> writes: > On Tue, Sep 04, 2007 at 11:01:40PM -0700, ext Jayesh Salvi wrote: >> If you end up registering your signal handlers - do only little in those >> signal handlers. It's not a good idea to keep executing once you have >> corrupted memory - you might run into more ugly errors. > > Indeed, man signal (at least from glibc) explicitly lists the only calls > that are safe to run from signal handlers. Which is of course a different thing: even if you only use the signal-safe functions in your handler, you shouldn't ever return from it and try to continue the program. ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Trapping application "crashes"?
Hi, ext Jayesh Salvi wrote: > If you can modify application's code (at least the main() entry point) you > can register signal handlers for SIGSEGV, SIGABRT (most common causes of > program crashes) etc. Do "man signal" for more info. If the program is in > other languages then there should be corresponding ways to register these > signal handlers. > > If you don't have access to source code then only way that I can suggest is > running from debugger. > > If you end up registering your signal handlers - do only little in those > signal handlers. It's not a good idea to keep executing once you have > corrupted memory - you might run into more ugly errors. In general trapping FATAL signals causes more troubles than it's worth. On ARM you cannot get working backtraces (unless you compile all code on the target with -fno-omit-frame-pointer), so it's pretty pointless to catch SIGSEGV & SIGABRT. At worst you make it impossible to find the real problem. E.g. if C-library aborts your program due to memory corruption, no function requiring memory allocation, such as backtrace(), printf() etc works properly, they crash instead (maybe causing recursion and eventually really "fun to debug" backtrace in the core dump). - Eero ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Trapping application "crashes"?
On Tue, Sep 04, 2007 at 11:01:40PM -0700, ext Jayesh Salvi wrote: > If you end up registering your signal handlers - do only little in those > signal handlers. It's not a good idea to keep executing once you have > corrupted memory - you might run into more ugly errors. Indeed, man signal (at least from glibc) explicitly lists the only calls that are safe to run from signal handlers. Cheers, Daniel signature.asc Description: Digital signature ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Trapping application "crashes"?
If you can modify application's code (at least the main() entry point) you can register signal handlers for SIGSEGV, SIGABRT (most common causes of program crashes) etc. Do "man signal" for more info. If the program is in other languages then there should be corresponding ways to register these signal handlers. If you don't have access to source code then only way that I can suggest is running from debugger. If you end up registering your signal handlers - do only little in those signal handlers. It's not a good idea to keep executing once you have corrupted memory - you might run into more ugly errors. HTH Jayesh On 9/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Is it possible for an application to trap abnormal termination? In other > words, can a callback be registered that will be invoked when the > application is about to be shut down because of an error that the > application itself has caused (e.g. memory allocation errors or other > problems that would cause the OS to terminate the application). > > > David Hazel > ___ > maemo-developers mailing list > maemo-developers@maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers > ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers
Trapping application "crashes"?
Is it possible for an application to trap abnormal termination? In other words, can a callback be registered that will be invoked when the application is about to be shut down because of an error that the application itself has caused (e.g. memory allocation errors or other problems that would cause the OS to terminate the application). David Hazel ___ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers