| www.delorie.com/archives/browse.cgi | search |
| Xref: | news-dnh.mv.net comp.os.msdos.djgpp:2411 |
| Newsgroups: | comp.os.msdos.djgpp |
| Path: | news-dnh.mv.net!mv!news.sprintlink.net!news.uoregon.edu!gatech!news.mathworks.com!tank.news.pipex.net!pipex!sunsite.doc.ic.ac.uk!lut.ac.uk!R.Jaycocks1 |
| From: | R DOT Jaycocks1 AT lut DOT ac DOT uk (Robert Jaycocks) |
| Subject: | Re: a hrruah, then a tear... |
| Sender: | usenet AT lut DOT ac DOT uk (Usenet-News) |
| Date: | Wed, 4 Oct 1995 23:52:13 GMT |
| References: | <DFy082 DOT MnG AT jade DOT mv DOT net> |
| Organization: | Loughborough University, UK. |
| Lines: | 49 |
| To: | djgpp AT sun DOT soe DOT clarkson DOT edu |
| Dj-Gateway: | from newsgroup comp.os.msdos.djgpp |
Todd Muhlfelder (twm AT escape DOT com) wrote:
: I finally compiled my sample demo prog after days of slaving over the
: puter. My code compiled fine using "gcc prog.c -o prog -lpc". Then I
: ran "coff2exe prog". I got an EXE!!! HURRAH!
: Then I ran the EXE and got an error message which I cannot figure out.
: Segmentation voidlation in pointer 0x800020c8 at d8:1c09
: eax = 800020c8 ebx = 00004200 ecx = 800040c8 edx = 800020c8
: esi = 00000000 ebp = 7ffffeb8 esp = 7ffffe9c cs = d8
: ds = 48 es = 48 fs = 48 gs = 38 ss = 48 cr2 = 000020c8
: Call frame traceback EIP's:
: 0x00001c09
: 0x0000156e
: Please tell me what I am doing wronga and help me fix it!
: thanks in advance
: twm AT escape DOT com
Recompile your program with debugging support ie:
gcc -g -Wall prog.c -o prog -lpc
The -Wall option will give warnings on aspects of your code. Refer to the
gnu info documentation for more info.
Next use GDB to debug your program. Depending on which version of djgpp
you are using, and which environment, will depend on how you run the
debugger. Under v1.12
Not under a DPMI client (eg Windows) go32 -d gdb prog
Under a DPMI client go32 -d gdb-dpmi prog
For djgppv2beta????
gdb prog
When in the debugger type r to run the program. The debugger should
then stop at the offending piece of code. Another alternative is to
run the program using go32 (go32 prog), then use symify to display
the traceback eip's. For your example you would type
symify prog
I suggest you sit down and spend some time looking at the info
documents that comes with djgpp on how to use the available
routines. Most segmentation violation errors generally occur
due to pointers referencng invalid memory. This could be due to
not enoung memory being malloced, or an array is too small.
Hope this helps
Robert.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |