www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/18/04:01:22

From: "Carolyn Kelly-Pajot" <dehacked72 AT hotmail DOT com>
References: <346E9FE1 DOT 1998659C AT pitt DOT edu>
Subject: Re: Problem with executable code
Date: Sun, 16 Nov 1997 15:14:40 -0500
Lines: 75
Message-ID: <OYgcJvs88GA.292@upnetnews03>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

David Rager wrote in message <346E9FE1 DOT 1998659C AT pitt DOT edu>...
>I was asked a question about text i/o. To answer the question I began to
>write this small program to demonstrate file i/o in c++. I ran into a
>problem with my output. I cannot find anything wrong with my logic but I
>have not yet been able to come up with the correct output. Here is a
>listing of my program, input file and resulting output.
>
>>>>>>snip
>input:
>
>Orville's Acre, 12  237
>Chaney's Barn, 33 439
>Jones Gap, 81 63
>
>output:
>
>Q 237 0
>Chaney's Barn 439 12
>Jones Gap 63 33
>
>I cannot figure out why the first index of the array's are being
>corrupted. Another weird problem is if I reverse the order in which
>intArray and wordlist are declared I get the following General
>protection fault:
>
>Exiting due to signal SIGSEGV
>General Protection Fault as eip=00000064
>eax=00000000 ebx=00000000 ecx=0000831e edx=00062160 esi=00064070
>edi=00000003
>ebp=00065100 esp=00060740 program=C:\C__~1\CHARIO\CHARIO.EXE
>cs: sel=00a7 base=831e0000 limit=0007ffff
>ds: sel=00af base=831e0000 limit=0007ffff
>es: sel=00af base=831e0000 limit=0007ffff
>fs: sel=0087 base=000092f0 limit=0000ffff
>gs: sel=00bf base=00000000 limit=ffffffff
>ss: sel=00af base=831e0000 limit=0007ffff
>
>Call frame traceback EIPs:
>   0x00000064
>   0x00062020
>   0x575c3a43
>
>and this output:
>
>Orville's Acre 237 1
>Chaney's Barn 439 12
>Jones Gap 63 33
>
>I know that wordlist [0] is being corrupted when j is incremented the
>last time but I cannot figure out why. And I am completely confused as
>to why the order my vars are declared create such different outcomes. I
>was using pointers and dynamically allocating space but as I've been
>trying to track down these problems I've been going back to basics
>declaring fixed sized arrays, etc.
>
>If you can help me with this problem, please post a reply here and
>e-mail it to my address below. I don't know when I'll be able to check
>back here for a reply but at least it may be sitting in my mailbox ;)
>I really appreciate any help you may give.
>
>Thanx in advance.
>Dave.
>--
>David J. Rager
>University of Pittsburgh at Johnstown
>e-mail:    djrst14 AT pitt DOT edu
>Internet:  http://www.pitt.edu/~djrst14

A debugger comes to mind. Try RHIDE. It looks good, and is easy to work.

Try a call frame trace-back. RHIDE can help you by giving you line numbers,
function names, etc. That should help you.


- Raw text -


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