delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/18/14:40:02

Message-Id: <m0z8qdr-000S4AC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "John Spence" <jspence AT lynx DOT net DOT au>, djgpp AT delorie DOT com
Date: Tue, 18 Aug 1998 15:48:15 +0000
MIME-Version: 1.0
Subject: Re: tracking down runtime error
In-reply-to: <35dab9f3.3381119@l>

"John Spence" <jspence AT lynx DOT net DOT au> wrote:

> Using the following code to display the contents of a linked list with
> DJGPP  (gcc2721b)
> 
> void traverse(NODEPTR start)
> {
>   while(start)
>   {
>     printf("%d\n", start->number);
>     start = start->next;
>   }
> }
> 
> I get the error which follows during runtime.  I can run this program
> without a problem under Linux with gcc and DOS with Turbo C so I am
> 99% confident that this is not a problem with my code.
> 
> Cany anyone help me pinpoint the cause of this error with DJGPP/gcc
> (dos) or refer me to a doc that will.
> 
> 
> The values that should have been displayed are 5, 4, 3, 700, 900, 100

As you don't provide the program we can only make a wild guess.
 
> ====== start of program output ==================
> 5
> 4
> 3
> 700
> 134744064

Here the program is out-of-control, I guess you are just corrupting the heap 
and overwriting the node that contains 900, as the whole node is corrupted 
the pointer is crap and when you try to use it:

> Exiting due to signal SIGSEGV
> General Protection Fault at eip=000016ab
> eax=08080808 ebx=0004f120 ecx=00000000 edx=08080808 esi=00000054
> edi=0000dac0
> ebp=0004da7c esp=0004da7c program=D:\UNITEMP\C\PRAC3A.EXE
> cs: sel=00af  base=82cc9000  limit=0006ffff
> ds: sel=00b7  base=82cc9000  limit=0006ffff
> es: sel=00b7  base=82cc9000  limit=0006ffff
> fs: sel=0087  base=0000af90  limit=0000ffff
> gs: sel=00c7  base=00000000  limit=ffffffff
> ss: sel=00b7  base=82cc9000  limit=0006ffff
> 
> Call frame traceback EIPs:
>   0x000016ab
>   0x00001619
>   0x00001c5e

Run symify to make it better ;-) 

So: try to isolate what part of your code makes it. Just cut all the code 
that could make it and try again. The process is tedious but works. Do it 
like a binary search, I mean, cut all the code if works enable half if fails 
restrict the search to this half, etc

SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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