delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/31/15:19:31

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GPF decoding
Date: Sun, 31 Aug 1997 02:05:57 +0100
Organization: None
Distribution: world
Message-ID: <YJSVGXA1NMC0EwbP@talula.demon.co.uk>
References: <3403DAF8 DOT 7841 AT post DOT comstar DOT ru>
<Pine DOT SUN DOT 3 DOT 91 DOT 970827141638 DOT 8439B-100000 AT is>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 68
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii writes:
>On Wed, 27 Aug 1997, Dim Zegebart wrote:
>
>> Shutting down Allegro
>> Exiting due to signal SIGSEGV
>> General Protection Fault at eip=1cf8b; flags=3016
>> eax=00030000 ebx=0000000d ecx=ffffffff edx=30202020 esi=30202020
>> edi=30202020
>> ebp=0000000d esp=00033260 cs=a7 ds=af es=af fs=b7 gs=bf ss=af error=0000
>> 
>> Are any ways to decode it? symify ,obviously, don't work since call
>> frame traceback is absent.
>
>You didn't say you are linking with Allegro.  This complicates debugging 
>somewhat.
>
>The first thing to do is to load the program into a debugger and 
>unassemble near the address 0x1cf8b (the value of EIP at the crash 
>point).  But I'm afraid you will see that this address is in the signal 
>handler installed by Allegro, which doesn't help much.
>
>Shawn, can you suggest some debugging techniques if that is indeed the 
>case?

Usually, you will get a normal stack traceback regardless of whether you
are using Allegro or not, since my emergency exit signal handler chains
to the original libc routines. Allegro traps a lot of different signals,
but the handler is very simple:


/* signal_handler:
 *  Used to trap various signals, to make sure things get shut down 
 *  cleanly.
 */
static void signal_handler(int num)
{
   static char msg[] = "Shutting down Allegro\r\n";

   allegro_exit();

   _write(STDERR_FILENO, msg, sizeof(msg)-1);

   signal(num, SIG_DFL);
   raise(num);
}


Allegro uses the -fomit-frame-pointer optimisation option, which can
upset symify. It might help to build a debug version of the lib, by
emptying out the allegro/obj/djgpp/ directory, setting the environment
variable DEBUGMODE=1, and then running 'make install'. Keep a backup of
your old liballeg.a, though, because the new one will be huge and very
slow!

Even with -fomit-frame-pointer, though, there should be at least one
location in the stack traceback. At a guess, after your program raises
some kind of exception, the allegro_exit() function is itself crashing,
leading to a nested fault and upsetting the whole shebang. Try removing
the call to allegro_exit() from the signal handler (in allegro.c), and
see if you get a more reasonable output. Your system will probably hang
when the program dies (it will be left in graphics mode with all the
interrupt handlers active), but if you redirect stderr into a file it
should be possible to recover the traceback for later examination...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019