Mail Archives: djgpp/1998/09/25/05:02:58
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> said:
> .. The only thing that's lost is the
> registers' dump. If you need that, you will probably need to hack the
> signal-handling code (dpmiexcp.c in djlsr201.zip) to store away the
> exception structure. But do you really need the registers?
Wild values in EDI/ESI often indicates a pointer error. Using Fortify
(a debug malloc lib), EDI/ESI with value 0xA9A9A9A9 tells me I'm using
a dynamic array after it's freed. So yes, the registers are important.
To preserve the exception structure at `__djgpp_exception_state_ptr',
I simply copied it to a local jmp_buf and used that as exception structure
on a nested crash. Works fine AFAIK.
> raise(SIGABRT) in v2.01 just prints "Abort!" and exits. So you don't get
> any traceback at all, if shutdown doesn't crash.
This little test program tells me otherwise:
#include <signal.h>
void shutdown (int crash)
{
if (crash)
*(char*)-1 = 1;
}
void exc_handler (int sig)
{
signal (SIGSEGV,SIG_DFL);
shutdown (0);
raise (SIGABRT);
}
int main (void)
{
signal (SIGSEGV,exc_handler);
*(char*)-1 = 1;
return (0);
}
-------------------------------------------------------------------------
In djgpp 2.01:
Exiting due to signal SIGABRT
General Protection Fault at eip=000015aa
eax=00000000 ebx=0004db80 ecx=00001564 edx=00000123 esi=00000054 edi=0000a2d4
ebp=0004a2a8 esp=0004a2a8 program=C:\TEMP\MISC\EXC2.EXE
cs: sel=00a7 base=10000000 limit=0005ffff
ds: sel=00af base=10000000 limit=0005ffff
es: sel=00af base=10000000 limit=0005ffff
fs: sel=008f base=00004200 limit=0000ffff
gs: sel=00bf base=00000000 limit=ffffffff
ss: sel=00af base=10000000 limit=0005ffff
Call frame traceback EIPs:
0x000015aa _main+26
0x00001b0e ___crt1_startup+138
In djgpp 2.02:
Exiting due to signal SIGABRT
General Protection Fault at eip=000015be
eax=00000000 ebx=00001000 ecx=00000488 edx=00008240 esi=00000054 edi=0000b0f0
ebp=0008b0d0 esp=0008b0d0 program=C:\TEMP\MISC\EXC2.EXE
cs: sel=00a7 base=10000000 limit=0009ffff
ds: sel=00af base=10000000 limit=0009ffff
es: sel=00af base=10000000 limit=0009ffff
fs: sel=008f base=00004220 limit=0000ffff
gs: sel=00bf base=00000000 limit=0010ffff
ss: sel=00af base=10000000 limit=0009ffff
App stack: [0008b0f0..0000b0f0] Exceptn stack: [0000afd0..00009090]
Call frame traceback EIPs:
0x000015be _main+46
0x00001bba ___djgpp_exception_table+166
I notice the selector bases are the same, but some limits are much larger
(256kB) in 2.02. What the extra space used for?
Gisle V.
- Raw text -