From: Roman Suzi Newsgroups: comp.os.msdos.djgpp Subject: Re: General Protection Fault interception vs. Checking stack Date: Sat, 08 Nov 97 15:40:37 +0300 Distribution: su Organization: unknown Message-ID: Sender: news-service AT sampo DOT karelia DOT ru Reply-To: nuser AT rsuzi DOT pgu DOT karelia DOT ru Lines: 138 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi! >On Fri, 7 Nov 1997, Roman Suzi wrote: > >> >Did you try to install a handler for the signal SIGSEGV, using the >> >`signal' library function? If so, what did you see? >> >> Yes, of course. > >What happened when you installed the handler? Can you provide a >detailed description? I have already answered to djgpp newsgroup with the program example. That example doesn hang computer. Let me give you more serious example, which does hang my computer (it is actual, so even irrelevant thing are left there): ------- oflow.cc ------------------- #include #include #include volatile int tmp = 0; static void handler(int sig) { cerr << "error handler, signal = " << sig << '\n'; tmp = 1; // signal(SIGFPE, handler); exit(-1); } volatile int enough_mem = 1; void my_mem_error() { cerr << "\nMemory is low!!!"; enough_mem = 0; }; int myproc(int a, double t) { if (a<0) return 1; else return myproc(a-1, a+0.23); } int *ip; int myalloc(int a, double t) { for (int i=0; i> ii; myproc(ii,0.2); cerr << "\n * Thats all *\n"; cout << "\n * Thats all *\n"; } ---------------------------------------- No switches were used when compiled (just -liostr), no optimization. Code size after compiling: 195123 bytes. CWSDPMI binary distribution (release 3) gcc2721 DJGPP v2 (2.01 to be precise) Computer: 486DX4-100, 16 Mb RAM. In reply to 1000000 for ii, the program gives: "General Protection Fault at eip=e51e; flags=3046" and hangs. (It cant even output dump properly!) Sometimes it gives one more string of the dump: "eax= ......." Sometimes it stops IN THE PROCESS of screen scrolling!!! (partially duplicated last line says about it. It is as if someone presses 'Pause' in the middle of text output.) -- very strange, indeed! It behaves bad even if all handler hooks but signal(SIGSEGV ...) are commented out. Possibly my problem will not be visible on faster computers and, especially, faster video systems (I have slow LCD display). That is all I see as relevant to the problem. Roman. -- -- * -- -- Roman A. Suzi * Petrozavodsk Karelia Russia -- -- http://sampo.karelia.ru/~rnd --