Subject: Re: Exception handling MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Thu, 6 Jun 2002 15:22:40 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 Message-ID: <36F74B8910ED2E4AB98A2E8829085F151727@email2k.compuweigh.com> content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Exception handling Thread-Index: AcINj4XZCtFZl2IrQ02w7BrGmB6bzA== From: "Alex" To: Cc: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g56JHkU23993 Reply-To: djgpp AT delorie DOT com "Eli Zaretskii" wrote in message news:... > > On Thu, 6 Jun 2002, Alex Oleynikov wrote: > > > 1.First of all, I am using 'REDIR -e crash.dmp myprog.exe' to capture the > > stderr output from my application. In 99% of crash situations the resulting > > crash.dmp file is empty, although if I run the program directly I can see > > the stack traceback output on the screen. Also, if I redirect it to a > > printer it prints the whole thing fine. Why doesn't REDIR save this > > information to my file? > > It does for me. I think this is something specific to your system or > your crashes. What OS is that? Can you post a short program that > crashes, for which `redir' doesn't produce a traceback in a file? I am using PTS-DOS. I will try to write a small program to re-create this behavior. > Btw, if it's NT or Windows 2000, there's an incompatible program called > redir.exe, so perhaps you inadvertently use that instead of the DJGPP > version of `redir'. Unlikely, since I use DJGPP in plain DOS only. > > > 2.I hooked my handlers to several signals (SIGINT, SIGABRT, SIGSEGV and > > SIGFPE). The handler basically saves a timestamp and the signal description > > to a file, displays a message on the screen and calls > > __djgpp_traceback_exit( ) procedure. For some reason, when SIGABRT signal is > > being processed, the computer locks up completely when calling > > __djgpp_traceback_exit(). I also tried using exit() or simply return from > > the signal handler (since the SIGABRT is raised from assert()) - the result > > is always the same - the computer locks up. Why is that? > > SIGABRT is not a real exception, so it's treated a bit differently. > However, it shouldn't lock up. Please show the code of your signal > handler, and how you install it, there's probably something wrong with > that. This was my mistake. While the message was displayed on the screen, some activity was still going on the background in the application. As soon as I made this message blocking the lock up is gone. > > 2.If I will not be able to solve the problem with REDIR, is there a way to > > get an output similar to the one produced by __djgpp_traceback_exit(), but > > without terminating the application? In other words, can I somehow save the > > stack traceback to a log file from within my signal handler? > > The sources of the library are freely available: download djlsr203.zip > and look at the file src/libc/go32/dpmiexcp.c, where you will find the > code that prints the traceback. Thanks for pointing me to a right direction. Thanks for you help. Alex