delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/24/02:00:15

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 <main+11>: mov $0xd270,%edx     
0x1690 <main+16>: push %esi      
0x1691 <main+17>: push %ebx      
0x1692 <main+18>: sub $0x3c,%esp     
0x1695 <main+21>: and $0xfffffff0,%esp     
0x1698 <main+24>: movl $0x0,0xf984     
0x16a2 <main+34>: movl $0x0,(%ecx,%eax,4)    
0x16a9 <main+41>: movl $0x0,(%edx,%eax,4)    
0x16b0 <main+48>: inc %eax      
0x16b1 <main+49>: mov %eax,0xf984     
0x16b6 <main+54>: cmp $0x62,%eax     
0x16b9 <main+57>: jle 0x16a2 <main+34>     
0x16bb <main+59>: cmpl $0x1,0x8(%ebp)     
0x16bf <main+63>: jle 0x1f43 <main+2243>    
0x16c5 <main+69>: push %eax      
0x16c6 <main+70>: mov 0xc(%ebp),%eax     
0x16c9 <main+73>: push $0x1a634      
0x16ce <main+78>: push $0x15e0      
---Type <return> to continue, or q <return> 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.

- Raw text -


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