X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Lines: 81 X-Admin: news AT aol DOT com From: sterten AT aol DOT com (Sterten) Newsgroups: comp.os.msdos.djgpp Date: 24 Jul 2004 05:44:54 GMT References: <2719-Fri23Jul2004140734+0300-eliz AT gnu DOT org> Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com Subject: Re: strange error Message-ID: <20040724014454.16860.00001365@mb-m20.aol.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >This works because the debuggers catches fatal signals of the program >it runs, and a crash is a fatal signal (SIGSEGV in your case). > I haven't used a debugger since quite some time. OK, following your instructions I get: ----------------------------------------------------------- C:\DJGPP>gcc qser3.c -O2 -o qser3.exe C:\DJGPP>gdb qser3.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-pc-msdosdjgpp"... (no debugging symbols found)... (gdb) run 16 1 5 Starting program: c:/djgpp/qser3.exe 16 1 5 Program received signal SIGSEGV, Segmentation fault. 0x00001cfc in ?? () (gdb) quit The program is running. Exit anyway? (y or n) y C:\DJGPP>scrsav >qser8 --------------------------------------------------- C:\DJGPP>gcc qser3.c -O1 -o qser3.exe C:\DJGPP>gdb qser3.exe ... (gdb) run 16 1 5 Starting program: c:/djgpp/qser3.exe 16 1 5 8 solutions Program exited with code 016. ------------------------------------------------------ disassemble after SIGSEV gives: ... 0x168b : mov $0xd270,%edx 0x1690 : push %esi 0x1691 : push %ebx 0x1692 : sub $0x3c,%esp 0x1695 : and $0xfffffff0,%esp 0x1698 : movl $0x0,0xf984 0x16a2 : movl $0x0,(%ecx,%eax,4) 0x16a9 : movl $0x0,(%edx,%eax,4) 0x16b0 : inc %eax 0x16b1 : mov %eax,0xf984 0x16b6 : cmp $0x62,%eax 0x16b9 : jle 0x16a2 0x16bb : cmpl $0x1,0x8(%ebp) 0x16bf : jle 0x1f43 0x16c5 : push %eax 0x16c6 : mov 0xc(%ebp),%eax 0x16c9 : push $0x1a634 0x16ce : push $0x15e0 ---Type to continue, or q to quit---q Quit (gdb) quit The program is running. Exit anyway? (y or n) y C:\DJGPP>scrsav >>qser8 I also tried to get the whole output with >>file or redir, but failed now, maybe this can be used to find the line, where it crashed , but it's not easy. And then, we still don't know the first line, where an incorrect index occurred. There can be many incorrect indices before without the program crashing. --Guenter.