delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/25/01:47:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Lines: 665
X-Admin: news AT aol DOT com
From: sterten AT aol DOT com (Sterten)
Newsgroups: comp.os.msdos.djgpp
Date: 25 Jul 2004 05:32:14 GMT
References: <2914-Sat24Jul2004104537+0300-eliz AT gnu DOT org>
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
Subject: Re: strange error
Message-ID: <20040725013214.18573.00000172@mb-m22.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli wrote:

 >> only the final one, where it crashed
 >
 >Sure; but that's better than what you have now (which is nothing
 >except guesses).

I'm 90% sure, that it's the line which I posted, 
m55:r--;if(R[r]!=1)goto m55;  and then r becomes negative.
Then I assume r runs into array Sym[99][99] which was initialized 
immediately before R99]. It should stop at Sym[16][16] which 
should be the first entry which is =1. Then presumably r is
0-99*99+16*16=-9545 (modulo modifications due to starting at 1 vs.0,
I'm too lazy to check this)
Then the next line is c=C[r] .. then setting R[9562]=0 which is
about 9000*4 bytes behind the last defined data-area-element ...
then setting C[c]=0 and I don't really know, what value
c=C[-9545] is here.
Somewhere here the program crashes (or not).

Now, this all wouldn't have happened if the _first_ version had crashed
after I included the m55:.. line. But it ran correctly, so I assumed
my new version were OK , did some other changes .. and then 
suddenly it crashed and I didn't know, why.


 >>  >Bottom line, using the debugger in such cases might need some hard
 >>  >work, but it is always the shortest way to the solution, because it
 >>  >saves you the need to guess.

..which is sometimes the shorter way to the solution
 
 >> wouldn't a compiler which checks the indices 
 >> (I found compaq-C with google) be a shorter solution here ?
 >
 >If the indices are the culprit, yes.  But we don't know that, do we?

with high probability

 >> under DOS:
 >> gdb qser3.exe > file
 >> run 16 1 5   (typed blindly)
 >> disassemble  (typed blindly)
 >> 
 >> crash, no way to escape, reboot
 >
 >What type of crash?  Did you see any messages? did it freeze? what
 >happened?

just as below. When I type 2 times quit<enter> then I see one quit
and XXes after break.

 >> redir -o file gdb qser3.exe
 >> run 16 1 5   (typed blindly)
 >> disassemble  (typed blindly)
 >> quit (typed blindly)
 >> quit (now displayed)
 >
 >Try "yes" at this point.

works ! I forgot. Result see below.

 >> <break>
 >
 >BAD IDEA.

only chance. Alternative was immediate reboot.
Usually I have this "hbreak" TSR running which allows me to escape
programs but I removed it recently to exclude its possible responsibility
for the "strange error".

----------------------------------


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 main ()
(gdb) disassemble
Dump of assembler code for function main:
0x1680 <main>:	push   %ebp
0x1681 <main+1>:	xor    %eax,%eax
0x1683 <main+3>:	mov    %esp,%ebp
0x1685 <main+5>:	mov    $0xd0d0,%ecx
0x168a <main+10>:	push   %edi
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
0x16d3 <main+83>:	mov    0x4(%eax),%eax
0x16d6 <main+86>:	push   %eax
0x16d7 <main+87>:	call   0x3b90 <sscanf>
0x16dc <main+92>:	add    $0x10,%esp
0x16df <main+95>:	mov    0x1a634,%edx
0x16e5 <main+101>:	mov    %edx,0xffffffc8(%ebp)
0x16e8 <main+104>:	test   %edx,%edx
0x16ea <main+106>:	js     0x1f29 <main+2217>
0x16f0 <main+112>:	movl   $0x1,0xffffffcc(%ebp)
0x16f7 <main+119>:	mov    0xffffffc8(%ebp),%edx
0x16fa <main+122>:	movl   $0x1,0x1a9f4
0x1704 <main+132>:	cmp    %edx,0xffffffcc(%ebp)
0x1707 <main+135>:	jg     0x1752 <main+210>
0x1709 <main+137>:	mov    $0x10e10,%ecx
0x170e <main+142>:	mov    $0x1,%esi
0x1713 <main+147>:	movl   $0x1,0xfcd4
0x171d <main+157>:	cmp    %edx,%esi
0x171f <main+159>:	jg     0x1738 <main+184>
0x1721 <main+161>:	lea    0x4(%ecx),%eax
0x1724 <main+164>:	inc    %esi
0x1725 <main+165>:	movl   $0x0,(%eax)
0x172b <main+171>:	mov    %esi,0xfcd4
0x1731 <main+177>:	add    $0x4,%eax
0x1734 <main+180>:	cmp    %edx,%esi
0x1736 <main+182>:	jle    0x1724 <main+164>
0x1738 <main+184>:	mov    0xffffffcc(%ebp),%ebx
0x173b <main+187>:	mov    0xffffffc8(%ebp),%edx
0x173e <main+190>:	inc    %ebx
0x173f <main+191>:	add    $0x18c,%ecx
0x1745 <main+197>:	mov    %ebx,0xffffffcc(%ebp)
0x1748 <main+200>:	mov    %ebx,0x1a9f4
0x174e <main+206>:	cmp    %edx,%ebx
0x1750 <main+208>:	jle    0x170e <main+142>
0x1752 <main+210>:	movl   $0x1,0xffffffcc(%ebp)
0x1759 <main+217>:	mov    0xffffffc8(%ebp),%eax
0x175c <main+220>:	movl   $0x0,0xffffffd0(%ebp)
0x1763 <main+227>:	movl   $0x0,0x1a5d4
0x176d <main+237>:	movl   $0x1,0x1a9f4
0x1777 <main+247>:	cmp    %eax,0xffffffcc(%ebp)
0x177a <main+250>:	jg     0x1f1c <main+2204>
0x1780 <main+256>:	movl   $0x63,0xffffffc4(%ebp)
0x1787 <main+263>:	mov    $0x1,%esi
0x178c <main+268>:	mov    %eax,%ecx
0x178e <main+270>:	movl   $0x1,0xfcd4
0x1798 <main+280>:	cmp    %eax,%esi
0x179a <main+282>:	jg     0x195f <main+735>
0x17a0 <main+288>:	mov    0xffffffc4(%ebp),%eax
0x17a3 <main+291>:	mov    %eax,0xffffffe8(%ebp)
0x17a6 <main+294>:	mov    0xffffffcc(%ebp),%edx
0x17a9 <main+297>:	mov    %esi,0x1a664
0x17af <main+303>:	mov    %edx,%eax
0x17b1 <main+305>:	mov    %edx,0x1a614
0x17b7 <main+311>:	imul   %ecx,%eax
0x17ba <main+314>:	lea    (%esi,%eax,1),%edx
0x17bd <main+317>:	add    %ecx,%eax
0x17bf <main+319>:	sub    %esi,%eax
0x17c1 <main+321>:	mov    %edx,0x1a644
0x17c7 <main+327>:	lea    0x1(%eax),%edi
0x17ca <main+330>:	mov    %edi,0x1a5c4
0x17d0 <main+336>:	cmp    %edx,%edi
0x17d2 <main+338>:	jge    0x17e4 <main+356>
0x17d4 <main+340>:	mov    %ecx,%eax
0x17d6 <main+342>:	mov    %edi,0x1a644
0x17dc <main+348>:	sub    %esi,%eax
0x17de <main+350>:	inc    %eax
0x17df <main+351>:	mov    %eax,0x1a664
0x17e4 <main+356>:	mov    0xffffffcc(%ebp),%edi
0x17e7 <main+359>:	mov    %ecx,%eax
0x17e9 <main+361>:	sub    %edi,%eax
0x17eb <main+363>:	mov    0x1a644,%edx
0x17f1 <main+369>:	inc    %eax
0x17f2 <main+370>:	mov    %eax,%ebx
0x17f4 <main+372>:	mov    %eax,0xfffffff0(%ebp)
0x17f7 <main+375>:	imul   %ecx,%ebx
0x17fa <main+378>:	lea    (%ecx,%ebx,1),%eax
0x17fd <main+381>:	sub    %esi,%eax
0x17ff <main+383>:	lea    0x1(%eax),%edi
0x1802 <main+386>:	mov    %edi,0x1a5c4
0x1808 <main+392>:	cmp    %edx,%edi
0x180a <main+394>:	jge    0x1826 <main+422>
0x180c <main+396>:	mov    0xfffffff0(%ebp),%eax
0x180f <main+399>:	mov    %edi,0x1a644
0x1815 <main+405>:	mov    %eax,0x1a614
0x181a <main+410>:	mov    %edi,%edx
0x181c <main+412>:	mov    %ecx,%eax
0x181e <main+414>:	sub    %esi,%eax
0x1820 <main+416>:	inc    %eax
0x1821 <main+417>:	mov    %eax,0x1a664
0x1826 <main+422>:	lea    (%esi,%ebx,1),%edi
0x1829 <main+425>:	mov    %edi,0x1a5c4
0x182f <main+431>:	cmp    %edx,%edi
0x1831 <main+433>:	jge    0x184a <main+458>
0x1833 <main+435>:	mov    0xfffffff0(%ebp),%edx
0x1836 <main+438>:	mov    %edi,0x1a644
0x183c <main+444>:	mov    %edx,0x1a614
0x1842 <main+450>:	mov    %esi,0x1a664
0x1848 <main+456>:	mov    %edi,%edx
0x184a <main+458>:	mov    %esi,%eax
0x184c <main+460>:	mov    0xffffffcc(%ebp),%ebx
0x184f <main+463>:	imul   %ecx,%eax
0x1852 <main+466>:	lea    (%ebx,%eax,1),%edi
0x1855 <main+469>:	mov    %edi,0x1a5c4
0x185b <main+475>:	cmp    %edx,%edi
0x185d <main+477>:	jge    0x1873 <main+499>
0x185f <main+479>:	mov    %edi,0x1a644
0x1865 <main+485>:	mov    %esi,0x1a614
0x186b <main+491>:	mov    %ebx,0x1a664
0x1871 <main+497>:	mov    %edi,%edx
0x1873 <main+499>:	add    %ecx,%eax
0x1875 <main+501>:	mov    0xffffffcc(%ebp),%ebx
0x1878 <main+504>:	sub    %ebx,%eax
0x187a <main+506>:	lea    0x1(%eax),%edi
0x187d <main+509>:	mov    %edi,0x1a5c4
0x1883 <main+515>:	cmp    %edx,%edi
0x1885 <main+517>:	jge    0x189d <main+541>
0x1887 <main+519>:	mov    0xfffffff0(%ebp),%eax
0x188a <main+522>:	mov    %edi,0x1a644
0x1890 <main+528>:	mov    %esi,0x1a614
0x1896 <main+534>:	mov    %eax,0x1a664
0x189b <main+539>:	mov    %edi,%edx
0x189d <main+541>:	mov    %ecx,%eax
0x189f <main+543>:	sub    %esi,%eax
0x18a1 <main+545>:	lea    0x1(%eax),%ebx
0x18a4 <main+548>:	mov    %ebx,%eax
0x18a6 <main+550>:	imul   %ecx,%eax
0x18a9 <main+553>:	mov    %eax,0xffffffec(%ebp)
0x18ac <main+556>:	add    %ecx,%eax
0x18ae <main+558>:	mov    0xffffffcc(%ebp),%ecx
0x18b1 <main+561>:	sub    %ecx,%eax
0x18b3 <main+563>:	lea    0x1(%eax),%edi
0x18b6 <main+566>:	mov    %edi,0x1a5c4
0x18bc <main+572>:	cmp    %edx,%edi
0x18be <main+574>:	jge    0x18d7 <main+599>
0x18c0 <main+576>:	mov    0xfffffff0(%ebp),%edx
0x18c3 <main+579>:	mov    %edi,0x1a644
0x18c9 <main+585>:	mov    %edx,0x1a664
0x18cf <main+591>:	mov    %ebx,0x1a614
0x18d5 <main+597>:	mov    %edi,%edx
0x18d7 <main+599>:	mov    0xffffffec(%ebp),%edi
0x18da <main+602>:	mov    0xffffffcc(%ebp),%eax
0x18dd <main+605>:	add    %eax,%edi
0x18df <main+607>:	mov    %edi,0x1a5c4
0x18e5 <main+613>:	cmp    %edx,%edi
0x18e7 <main+615>:	jge    0x18fe <main+638>
0x18e9 <main+617>:	mov    0xffffffcc(%ebp),%ecx
0x18ec <main+620>:	mov    %edi,0x1a644
0x18f2 <main+626>:	mov    %ebx,0x1a614
0x18f8 <main+632>:	mov    %ecx,0x1a664
0x18fe <main+638>:	mov    0x1a614,%eax
0x1903 <main+643>:	mov    0x1a664,%ecx
0x1909 <main+649>:	lea    (%eax,%eax,2),%eax
0x190c <main+652>:	mov    %eax,%edx
0x190e <main+654>:	shl    $0x5,%edx
0x1911 <main+657>:	add    %edx,%eax
0x1913 <main+659>:	add    %ecx,%eax
0x1915 <main+661>:	mov    0x10c84(,%eax,4),%edx
0x191c <main+668>:	test   %edx,%edx
0x191e <main+670>:	jne    0x1937 <main+695>
0x1920 <main+672>:	mov    0xffffffd0(%ebp),%edi
0x1923 <main+675>:	inc    %edi
0x1924 <main+676>:	mov    %edi,0xffffffd0(%ebp)
0x1927 <main+679>:	mov    0xffffffd0(%ebp),%ebx
0x192a <main+682>:	mov    %ebx,0x1a5d4
0x1930 <main+688>:	mov    %ebx,0x10c84(,%eax,4)
0x1937 <main+695>:	mov    0xffffffe8(%ebp),%edx
0x193a <main+698>:	mov    0x10c84(,%eax,4),%eax
0x1941 <main+705>:	add    %esi,%edx
0x1943 <main+707>:	mov    0xffffffc8(%ebp),%ecx
0x1946 <main+710>:	mov    %eax,0x10c84(,%edx,4)
0x194d <main+717>:	lea    0x1(%esi),%eax
0x1950 <main+720>:	mov    %eax,%esi
0x1952 <main+722>:	mov    %eax,0xfcd4
0x1957 <main+727>:	cmp    %ecx,%eax
0x1959 <main+729>:	jle    0x17a6 <main+294>
0x195f <main+735>:	mov    0xffffffc4(%ebp),%esi
0x1962 <main+738>:	mov    0xffffffc8(%ebp),%eax
0x1965 <main+741>:	add    $0x63,%esi
0x1968 <main+744>:	mov    %esi,0xffffffc4(%ebp)
0x196b <main+747>:	mov    0xffffffcc(%ebp),%esi
0x196e <main+750>:	inc    %esi
0x196f <main+751>:	mov    %esi,0xffffffcc(%ebp)
0x1972 <main+754>:	mov    %esi,0x1a9f4
0x1978 <main+760>:	cmp    %eax,%esi
0x197a <main+762>:	jle    0x1787 <main+263>
0x1980 <main+768>:	mov    0xc(%ebp),%ecx
0x1983 <main+771>:	push   %ebx
0x1984 <main+772>:	mov    0xffffffd0(%ebp),%edx
0x1987 <main+775>:	push   $0x1a9f4
0x198c <main+780>:	mov    %edx,0x1a5b4
0x1992 <main+786>:	push   $0x15e0
0x1997 <main+791>:	xor    %edi,%edi
0x1999 <main+793>:	mov    0x8(%ecx),%ecx
0x199c <main+796>:	push   %ecx
0x199d <main+797>:	call   0x3b90 <sscanf>
0x19a2 <main+802>:	mov    0xc(%ebp),%ebx
0x19a5 <main+805>:	add    $0xc,%esp
0x19a8 <main+808>:	mov    0x1a9f4,%edx
0x19ae <main+814>:	mov    0x1a634,%eax
0x19b3 <main+819>:	push   $0xfcd4
0x19b8 <main+824>:	sub    %edx,%eax
0x19ba <main+826>:	push   $0x15e0
0x19bf <main+831>:	inc    %eax
0x19c0 <main+832>:	mov    %eax,0xfb34
0x19c5 <main+837>:	mov    0xc(%ebx),%eax
0x19c8 <main+840>:	push   %eax
0x19c9 <main+841>:	call   0x3b90 <sscanf>
0x19ce <main+846>:	add    $0x10,%esp
0x19d1 <main+849>:	mov    0x1a634,%esi
0x19d7 <main+855>:	mov    0xfcd4,%ecx
0x19dd <main+861>:	mov    0xfb34,%edx
0x19e3 <main+867>:	mov    %esi,%ebx
0x19e5 <main+869>:	mov    %esi,0xffffffc8(%ebp)
0x19e8 <main+872>:	sub    %ecx,%ebx
0x19ea <main+874>:	mov    0x1a9f4,%esi
0x19f0 <main+880>:	inc    %ebx
0x19f1 <main+881>:	mov    %ebx,0x1a5f4
0x19f7 <main+887>:	lea    (%edx,%esi,1),%eax
0x19fa <main+890>:	mov    %esi,0xd270(,%esi,4)
0x1a01 <main+897>:	movl   $0x2,0xd0d0(,%esi,4)
0x1a0c <main+908>:	movl   $0x1,0x1aa04(,%eax,4)
0x1a17 <main+919>:	lea    (%ebx,%ecx,1),%eax
0x1a1a <main+922>:	mov    %ebx,0xd270(,%ecx,4)
0x1a21 <main+929>:	movl   $0x1,0xf9a4(,%esi,4)
0x1a2c <main+940>:	movl   $0x1,0x1a674(,%esi,8)
0x1a37 <main+951>:	movl   $0x2,0xd0d0(,%ecx,4)
0x1a42 <main+962>:	movl   $0x1,0xf9a4(,%ebx,4)
0x1a4d <main+973>:	movl   $0x1,0x1a674(,%eax,4)
0x1a58 <main+984>:	movl   $0x1,0x1aa04(,%ecx,8)
0x1a63 <main+995>:	lea    (%ebx,%edx,1),%eax
0x1a66 <main+998>:	mov    %ecx,0xd270(,%edx,4)
0x1a6d <main+1005>:	movl   $0x1,0xf9a4(,%ecx,4)
0x1a78 <main+1016>:	movl   $0x2,0xd0d0(,%edx,4)
0x1a83 <main+1027>:	lea    (%ecx,%edx,1),%ecx
0x1a86 <main+1030>:	mov    %edx,0xd270(,%ebx,4)
0x1a8d <main+1037>:	movl   $0x2,0xd0d0(,%ebx,4)
0x1a98 <main+1048>:	add    %esi,%ebx
0x1a9a <main+1050>:	movl   $0x1,0x1a674(,%ecx,4)
0x1aa5 <main+1061>:	movl   $0x1,0x1aa04(,%eax,4)
0x1ab0 <main+1072>:	movl   $0x1,0xf9a4(,%edx,4)
0x1abb <main+1083>:	movl   $0x1,0x1a674(,%eax,4)
0x1ac6 <main+1094>:	movl   $0x1,0x1aa04(,%ebx,4)
0x1ad1 <main+1105>:	movl   $0x0,0x1a5c4
0x1adb <main+1115>:	inc    %edi
0x1adc <main+1116>:	mov    %edi,0x1a5c4
0x1ae2 <main+1122>:	mov    0xd0d0(,%edi,4),%eax
0x1ae9 <main+1129>:	test   %eax,%eax
0x1aeb <main+1131>:	jne    0x1adb <main+1115>
0x1aed <main+1133>:	cmp    0xffffffc8(%ebp),%edi
0x1af0 <main+1136>:	jg     0x1dda <main+1882>
0x1af6 <main+1142>:	movl   $0x0,0xd270(,%edi,4)
0x1b01 <main+1153>:	mov    $0xd270,%eax
0x1b06 <main+1158>:	mov    (%eax,%edi,4),%edx
0x1b09 <main+1161>:	inc    %edx
0x1b0a <main+1162>:	mov    %edx,(%eax,%edi,4)
0x1b0d <main+1165>:	mov    %edx,0x1a654
0x1b13 <main+1171>:	cmp    0xffffffc8(%ebp),%edx
0x1b16 <main+1174>:	jg     0x1cd0 <main+1616>
0x1b1c <main+1180>:	mov    0xffffffc8(%ebp),%eax
0x1b1f <main+1183>:	sub    %edi,%eax
0x1b21 <main+1185>:	lea    0x1(%eax),%ebx
0x1b24 <main+1188>:	mov    0xffffffc8(%ebp),%eax
0x1b27 <main+1191>:	sub    %edx,%eax
0x1b29 <main+1193>:	mov    %ebx,0x1a624
0x1b2f <main+1199>:	cmp    %edx,%edi
0x1b31 <main+1201>:	lea    0x1(%eax),%ecx
0x1b34 <main+1204>:	mov    %ecx,0x1a5e4
0x1b3a <main+1210>:	je     0x1b01 <main+1153>
0x1b3c <main+1212>:	cmp    %ecx,%edi
0x1b3e <main+1214>:	je     0x1b01 <main+1153>
0x1b40 <main+1216>:	mov    0xf9a4(,%edx,4),%eax
0x1b47 <main+1223>:	test   %eax,%eax
0x1b49 <main+1225>:	jne    0x1b01 <main+1153>
0x1b4b <main+1227>:	lea    (%edx,%edi,1),%eax
0x1b4e <main+1230>:	mov    %eax,0xffffffe4(%ebp)
0x1b51 <main+1233>:	mov    0x1a674(,%eax,4),%eax
0x1b58 <main+1240>:	test   %eax,%eax
0x1b5a <main+1242>:	jne    0x1b01 <main+1153>
0x1b5c <main+1244>:	lea    (%ecx,%edi,1),%esi
0x1b5f <main+1247>:	mov    %esi,0xffffffe0(%ebp)
0x1b62 <main+1250>:	mov    0x1aa04(,%esi,4),%eax
0x1b69 <main+1257>:	test   %eax,%eax
0x1b6b <main+1259>:	jne    0x1b01 <main+1153>
0x1b6d <main+1261>:	mov    0xf9a4(,%ecx,4),%esi
0x1b74 <main+1268>:	test   %esi,%esi
0x1b76 <main+1270>:	jne    0x1b01 <main+1153>
0x1b78 <main+1272>:	lea    (%ecx,%ebx,1),%esi
0x1b7b <main+1275>:	mov    0x1a674(,%esi,4),%eax
0x1b82 <main+1282>:	test   %eax,%eax
0x1b84 <main+1284>:	jne    0x1b01 <main+1153>
0x1b8a <main+1290>:	lea    (%edx,%ebx,1),%eax
0x1b8d <main+1293>:	mov    %eax,0xffffffdc(%ebp)
0x1b90 <main+1296>:	cmpl   $0x0,0x1aa04(,%eax,4)
0x1b98 <main+1304>:	jne    0x1b01 <main+1153>
0x1b9e <main+1310>:	cmpl   $0x0,0xf9a4(,%edi,4)
0x1ba6 <main+1318>:	jne    0x1b01 <main+1153>
0x1bac <main+1324>:	mov    0x1a674(,%eax,4),%eax
0x1bb3 <main+1331>:	test   %eax,%eax
0x1bb5 <main+1333>:	jne    0x1b01 <main+1153>
0x1bbb <main+1339>:	mov    0xffffffe4(%ebp),%eax
0x1bbe <main+1342>:	mov    0x1aa04(,%eax,4),%eax
0x1bc5 <main+1349>:	test   %eax,%eax
0x1bc7 <main+1351>:	jne    0x1b01 <main+1153>
0x1bcd <main+1357>:	mov    0xf9a4(,%ebx,4),%eax
0x1bd4 <main+1364>:	test   %eax,%eax
0x1bd6 <main+1366>:	jne    0x1b01 <main+1153>
0x1bdc <main+1372>:	mov    0xffffffe0(%ebp),%eax
0x1bdf <main+1375>:	mov    0x1a674(,%eax,4),%eax
0x1be6 <main+1382>:	test   %eax,%eax
0x1be8 <main+1384>:	jne    0x1b01 <main+1153>
0x1bee <main+1390>:	mov    0x1aa04(,%esi,4),%eax
0x1bf5 <main+1397>:	test   %eax,%eax
0x1bf7 <main+1399>:	jne    0x1b01 <main+1153>
0x1bfd <main+1405>:	mov    0xfb44(,%edi,4),%eax
0x1c04 <main+1412>:	mov    %ebx,0xd270(,%edx,4)
0x1c0b <main+1419>:	inc    %eax
0x1c0c <main+1420>:	mov    %edi,0xd270(,%ecx,4)
0x1c13 <main+1427>:	mov    %eax,0xfb44(,%edi,4)
0x1c1a <main+1434>:	mov    %ecx,0xd270(,%ebx,4)
0x1c21 <main+1441>:	mov    $0xd0d0,%eax
0x1c26 <main+1446>:	mov    %edx,0xd270(,%edi,4)
0x1c2d <main+1453>:	movl   $0x1,0xf9a4(,%edx,4)
0x1c38 <main+1464>:	movl   $0x1,(%eax,%edi,4)
0x1c3f <main+1471>:	movl   $0x2,(%eax,%ebx,4)
0x1c46 <main+1478>:	movl   $0x1,0xf9a4(,%ecx,4)
0x1c51 <main+1489>:	movl   $0x2,(%eax,%edx,4)
0x1c58 <main+1496>:	mov    0xffffffe4(%ebp),%edx
0x1c5b <main+1499>:	movl   $0x2,(%eax,%ecx,4)
0x1c62 <main+1506>:	mov    0xffffffdc(%ebp),%ecx
0x1c65 <main+1509>:	movl   $0x1,0xf9a4(,%edi,4)
0x1c70 <main+1520>:	movl   $0x1,0xf9a4(,%ebx,4)
0x1c7b <main+1531>:	mov    0xffffffe0(%ebp),%ebx
0x1c7e <main+1534>:	movl   $0x1,0x1a674(,%edx,4)
0x1c89 <main+1545>:	movl   $0x1,0x1aa04(,%ebx,4)
0x1c94 <main+1556>:	movl   $0x1,0x1a674(,%esi,4)
0x1c9f <main+1567>:	movl   $0x1,0x1aa04(,%ecx,4)
0x1caa <main+1578>:	movl   $0x1,0x1a674(,%ecx,4)
0x1cb5 <main+1589>:	movl   $0x1,0x1aa04(,%edx,4)
0x1cc0 <main+1600>:	movl   $0x1,0x1aa04(,%esi,4)
0x1ccb <main+1611>:	jmp    0x1adb <main+1115>
0x1cd0 <main+1616>:	dec    %edi
0x1cd1 <main+1617>:	mov    %edi,0xffffffd8(%ebp)
0x1cd4 <main+1620>:	mov    %edi,0x1a5c4
0x1cda <main+1626>:	mov    %edi,%esi
0x1cdc <main+1628>:	cmpl   $0x1,0xd0d0(,%edi,4)
0x1ce4 <main+1636>:	jne    0x1cd0 <main+1616>
0x1ce6 <main+1638>:	mov    $0xd270,%eax
0x1ceb <main+1643>:	mov    0xffffffc8(%ebp),%ecx
0x1cee <main+1646>:	mov    0xffffffc8(%ebp),%edx
0x1cf1 <main+1649>:	sub    %edi,%ecx
0x1cf3 <main+1651>:	mov    (%eax,%edi,4),%ebx
0x1cf6 <main+1654>:	inc    %ecx
0x1cf7 <main+1655>:	sub    %ebx,%edx
0x1cf9 <main+1657>:	add    %ebx,%esi
0x1cfb <main+1659>:	inc    %edx
0x1cfc <main+1660>:	movl   $0x0,(%eax,%ebx,4)
0x1d03 <main+1667>:	movl   $0x0,0xd0d0(,%edi,4)
0x1d0e <main+1678>:	movl   $0x0,(%eax,%edx,4)
0x1d15 <main+1685>:	mov    %esi,0xffffffd4(%ebp)
0x1d18 <main+1688>:	movl   $0x0,(%eax,%ecx,4)
0x1d1f <main+1695>:	mov    %ebx,0x1a654
0x1d25 <main+1701>:	mov    $0xf9a4,%eax
0x1d2a <main+1706>:	mov    %edx,0x1a5e4
0x1d30 <main+1712>:	movl   $0x0,0xd0d0(,%ecx,4)
0x1d3b <main+1723>:	movl   $0x0,(%eax,%ebx,4)
0x1d42 <main+1730>:	mov    %ecx,0x1a624
0x1d48 <main+1736>:	movl   $0x0,(%eax,%edx,4)
0x1d4f <main+1743>:	movl   $0x0,(%eax,%edi,4)
0x1d56 <main+1750>:	movl   $0x0,(%eax,%ecx,4)
0x1d5d <main+1757>:	mov    $0x1a674,%eax
0x1d62 <main+1762>:	movl   $0x0,0xd0d0(,%ebx,4)
0x1d6d <main+1773>:	movl   $0x0,(%eax,%esi,4)
0x1d74 <main+1780>:	add    %ecx,%ebx
0x1d76 <main+1782>:	lea    (%edx,%ecx,1),%esi
0x1d79 <main+1785>:	movl   $0x0,0xd0d0(,%edx,4)
0x1d84 <main+1796>:	movl   $0x0,(%eax,%esi,4)
0x1d8b <main+1803>:	add    %edi,%edx
0x1d8d <main+1805>:	movl   $0x0,(%eax,%ebx,4)
0x1d94 <main+1812>:	test   %edi,%edi
0x1d96 <main+1814>:	mov    $0x1aa04,%eax
0x1d9b <main+1819>:	movl   $0x0,(%eax,%edx,4)
0x1da2 <main+1826>:	mov    0xffffffd4(%ebp),%edx
0x1da5 <main+1829>:	movl   $0x0,(%eax,%ebx,4)
0x1dac <main+1836>:	movl   $0x0,(%eax,%edx,4)
0x1db3 <main+1843>:	movl   $0x0,(%eax,%esi,4)
0x1dba <main+1850>:	jg     0x1b01 <main+1153>
0x1dc0 <main+1856>:	mov    0xd3fc,%eax
0x1dc5 <main+1861>:	push   %edx
0x1dc6 <main+1862>:	push   %edx
0x1dc7 <main+1863>:	push   %eax
0x1dc8 <main+1864>:	push   $0x15e3
0x1dcd <main+1869>:	call   0x3be0 <printf>
0x1dd2 <main+1874>:	lea    0xfffffff4(%ebp),%esp
0x1dd5 <main+1877>:	pop    %ebx
0x1dd6 <main+1878>:	pop    %esi
0x1dd7 <main+1879>:	pop    %edi
0x1dd8 <main+1880>:	pop    %ebp
0x1dd9 <main+1881>:	ret    
0x1dda <main+1882>:	mov    0xd3fc,%eax
0x1ddf <main+1887>:	mov    0x1a5b4,%ebx
0x1de5 <main+1893>:	inc    %eax
0x1de6 <main+1894>:	movl   $0x0,0xffffffcc(%ebp)
0x1ded <main+1901>:	mov    %eax,0xd3fc
0x1df2 <main+1906>:	cmp    %ebx,0xffffffcc(%ebp)
0x1df5 <main+1909>:	movl   $0x0,0x1a9f4
0x1dff <main+1919>:	jg     0x1e1e <main+1950>
0x1e01 <main+1921>:	mov    $0xfce4,%eax
0x1e06 <main+1926>:	mov    0xffffffcc(%ebp),%esi
0x1e09 <main+1929>:	movl   $0x0,(%eax,%esi,4)
0x1e10 <main+1936>:	inc    %esi
0x1e11 <main+1937>:	mov    %esi,0xffffffcc(%ebp)
0x1e14 <main+1940>:	mov    %esi,0x1a9f4
0x1e1a <main+1946>:	cmp    %ebx,%esi
0x1e1c <main+1948>:	jle    0x1e06 <main+1926>
0x1e1e <main+1950>:	movl   $0x1,0xffffffcc(%ebp)
0x1e25 <main+1957>:	mov    0xffffffc8(%ebp),%eax
0x1e28 <main+1960>:	movl   $0x1,0x1a9f4
0x1e32 <main+1970>:	cmp    %eax,0xffffffcc(%ebp)
0x1e35 <main+1973>:	jg     0x1e70 <main+2032>
0x1e37 <main+1975>:	mov    $0x63,%edx
0x1e3c <main+1980>:	mov    0xffffffcc(%ebp),%ecx
0x1e3f <main+1983>:	mov    $0xd270,%esi
0x1e44 <main+1988>:	mov    %edx,%eax
0x1e46 <main+1990>:	add    $0x63,%edx
0x1e49 <main+1993>:	add    (%esi,%ecx,4),%eax
0x1e4c <main+1996>:	mov    0x10c84(,%eax,4),%eax
0x1e53 <main+2003>:	movl   $0x1,0xfce4(,%eax,4)
0x1e5e <main+2014>:	lea    0x1(%ecx),%eax
0x1e61 <main+2017>:	mov    0xffffffc8(%ebp),%ecx
0x1e64 <main+2020>:	mov    %eax,0xffffffcc(%ebp)
0x1e67 <main+2023>:	mov    %eax,0x1a9f4
0x1e6c <main+2028>:	cmp    %ecx,%eax
0x1e6e <main+2030>:	jle    0x1e3c <main+1980>
0x1e70 <main+2032>:	xor    %edx,%edx
0x1e72 <main+2034>:	test   %ebx,%ebx
0x1e74 <main+2036>:	movl   $0x0,0x1a644
0x1e7e <main+2046>:	movl   $0x1,0x1a9f4
0x1e88 <main+2056>:	jle    0x1eaa <main+2090>
0x1e8a <main+2058>:	mov    $0x2,%ecx
0x1e8f <main+2063>:	mov    0xfce0(,%ecx,4),%eax
0x1e96 <main+2070>:	add    %eax,%edx
0x1e98 <main+2072>:	mov    %ecx,%eax
0x1e9a <main+2074>:	mov    %edx,0x1a644
0x1ea0 <main+2080>:	mov    %eax,0x1a9f4
0x1ea5 <main+2085>:	inc    %ecx
0x1ea6 <main+2086>:	cmp    %ebx,%eax
0x1ea8 <main+2088>:	jle    0x1e8f <main+2063>
0x1eaa <main+2090>:	mov    0xd400,%esi
0x1eb0 <main+2096>:	test   %esi,%esi
0x1eb2 <main+2098>:	je     0x1cd0 <main+1616>
0x1eb8 <main+2104>:	mov    $0x1,%eax
0x1ebd <main+2109>:	movl   $0x1,0xf984
0x1ec7 <main+2119>:	cmp    0xffffffc8(%ebp),%eax
0x1eca <main+2122>:	jle    0x1ef0 <main+2160>
0x1ecc <main+2124>:	sub    $0xc,%esp
0x1ecf <main+2127>:	push   $0x15f3
0x1ed4 <main+2132>:	call   0x3c30 <puts>
0x1ed9 <main+2137>:	mov    0x1a5c4,%edi
0x1edf <main+2143>:	mov    0x1a634,%ebx
0x1ee5 <main+2149>:	add    $0x10,%esp
0x1ee8 <main+2152>:	mov    %ebx,0xffffffc8(%ebp)
0x1eeb <main+2155>:	jmp    0x1cd0 <main+1616>
0x1ef0 <main+2160>:	mov    0xd270(,%eax,4),%ecx
0x1ef7 <main+2167>:	push   %ebx
0x1ef8 <main+2168>:	push   %ebx
0x1ef9 <main+2169>:	push   %ecx
0x1efa <main+2170>:	push   $0x15f6
0x1eff <main+2175>:	call   0x3be0 <printf>
0x1f04 <main+2180>:	mov    0xf984,%eax
0x1f09 <main+2185>:	inc    %eax
0x1f0a <main+2186>:	add    $0x10,%esp
0x1f0d <main+2189>:	mov    %eax,0xf984
0x1f12 <main+2194>:	cmp    0x1a634,%eax
0x1f18 <main+2200>:	jle    0x1ef0 <main+2160>
0x1f1a <main+2202>:	jmp    0x1ecc <main+2124>
0x1f1c <main+2204>:	mov    0x1a5d4,%eax
0x1f21 <main+2209>:	mov    %eax,0xffffffd0(%ebp)
0x1f24 <main+2212>:	jmp    0x1980 <main+768>
0x1f29 <main+2217>:	neg    %edx
0x1f2b <main+2219>:	mov    %edx,0xffffffc8(%ebp)
0x1f2e <main+2222>:	mov    %edx,0x1a634
0x1f34 <main+2228>:	movl   $0x1,0xd400
0x1f3e <main+2238>:	jmp    0x16f0 <main+112>
0x1f43 <main+2243>:	sub    $0xc,%esp
0x1f46 <main+2246>:	push   $0x1600
0x1f4b <main+2251>:	call   0x3c30 <puts>
0x1f50 <main+2256>:	movl   $0x1,(%esp,1)
0x1f57 <main+2263>:	call   0x3c60 <exit>
0x1f5c <main+2268>:	nop    
0x1f5d <main+2269>:	nop    
0x1f5e <main+2270>:	nop    
0x1f5f <main+2271>:	nop    
End of assembler dump.
(gdb) quit

------------------------------------

now, I think, I needn't do the assembly listing with GCC.
Let me write the important program lines :


global arrays:
int s2[999],Sym[99][99],R[99],C[99],Di1[222],Di2[222],Col[99],Node[99];
...
m55:r--;if(R[r]!=1)goto m55;   // this line presumably starts at 0x1cd0
    c=C[r];                    // this line presumably starts at 0x1ce6
    r2=n+1-r;c2=n+1-c;
    C[c]=0;                    // this line presumably starts at 0x1cfc,the
crashing address

we can get the registers :
C:\DJGPP>qser3 16 1 5 
Exiting due to signal SIGSEGV 
General Protection Fault at eip=00001cfc
eax=0000d270 ebx=a00f0706 ecx=00000099 edx=5ff0f90b esi=a00f067e edi=ffffff78  

ebp=0009cd60 esp=0009cd10 program=C:\DJGPP\QSER3.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=00026df0  limit=0000ffff                                    

gs: sel=00bf  base=00000000  limit=0010ffff                                    

ss: sel=00af  base=10000000  limit=0009ffff                                    

App stack: [0009cd80..0001cd80]  Exceptn stack: [0001cce0..0001ada0]           

                                                                          
      
Call frame traceback EIPs:                                                     

  0x00001cfc                                                                   

  0x000037a8                                                                   


so, R is 0xd0d0 , r = edi = 0xffffff78 = -136 , eax=0xd270 = C (?)
and presumably my assumption was incorrect that R[r] was pointing
into the Sym array. 
The order of where the arrays are stored could have been affected by
the small changes which changes the crashing behaviour.
Or maybe indices were read from the code-area.


Well, I could figure this all out by debugging the other versions with
small changes, with -g , -o1
I've not yet done this, maybe later.


--Guenter.

- Raw text -


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