Xref: news2.mv.net comp.os.msdos.djgpp:7374 From: krecik AT ii DOT uni DOT wroc DOT pl (Grzegorz Nowakowski) Newsgroups: comp.os.msdos.djgpp Subject: Re: Debugging woes... Date: 16 Aug 1996 11:52:00 GMT Organization: Laboratoire de Recherche en Informatique, UPS/CNRS, Orsay,FRANCE Lines: 40 Message-ID: References: <199608122312 DOT JAA05520 AT gbrmpa DOT gov DOT au> NNTP-Posting-Host: hp20.lri.fr In-reply-to: Leath Muller's message of Mon, 12 Aug 1996 23:12:46 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <199608122312 DOT JAA05520 AT gbrmpa DOT gov DOT au> Leath Muller writes: > The problem: When I run the program normally, it dies with a seg fault...I > have found the problem line using the traceback eip, and its: > x = temp->next->x; > in the subroutine which looks something like: > while (temp->next != NULL) > { > ... > x = temp->next->x; > ... > } > I KNOW that the original structures pointer to next is originally assigned > to NULL when it is added onto the end of a list (this is the only time > it crashes), but upon execution of the program from the command line (win.exe) > it crashes. Using printf of the temp->next value, I get some weird negative > number like -24. > > Anyway, I can't seem to debug it, because when I run the program under > fsdb and single step, run etc the program, it runs fine!!! > > WHY? Hmmm... I can't give you any serious hint, but according to my experience with linked structures there can be some sort of wild pointer. Once I had similar problem and it turned out that there was improper pointer teleporting data across all memory. Check also if you recompiled *all* modules when you change structure definition. And, finally, try to use gdb, IMHO it's more Borland-like than fsdb in subject of debugging power. :) -- Grzegorz Nowakowski -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GC dpu s:- a- C++(++++) ULSH P+>+++ L+>++++ E+(+++) W N++ o? K? w---() O? M- V? PS PE Y+ PGP-@ t+ 5? X? R+@ tv--- b+(+++) DI? D+ G e-> h* r-- y ------END GEEK CODE BLOCK------ finger hayden AT vax1 DOT mankato DOT msus DOT edu for info about geek codes