www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/21/03:37:33

From: "Ron Grunwald" <RGRUNWAL AT wasp DOT cs DOT cowan DOT edu DOT au>
Organization: Edith Cowan University
To: djgpp AT sun DOT soe DOT clarkson DOT edu,
Denis P Dersarkisian <denis AT oitunix DOT oit DOT umass DOT edu>
Date: Thu, 21 Dec 1995 16:16:09 GMT+800
Subject: Re: problem running C++ program
Reply-To: r DOT grunwald AT cowan DOT edu DOT au

Just a couple of brief observations:

> Hi everyone.  I've been having a problem running a C++ program that I've
> written. It compiles and links with no real problems. When I run it, though,
> I get this...
> 
> go32 test2
> go32 version 1.12.maint3 Copyright (C) 1994 DJ Delorie
> About to init vars
> done, returning...
> Segmentation violation in pointer 0x00000000 at d8:2298
                                    ^^^^^^^^^^
                                    This indicates some sort of 
manipulation of a NULL pointer.

> eax=00000000 ebx=00007024 ecx=7fffe710 edx=7fffe753 esi=7ffffc68 edi=00000008
> ebp=7fffe6ac esp=7fffe6a4 cs=d8 ds=48 es=48 fs=48 gs=38 ss=48 cr2=00000000
> Call frame traceback EIPs:
>   0x00002298
>   0x00001694
>   0x000024e6
> 
> The "about to init vars" and "done, returning" messages are made by printf's
 
       <more details followed>

> Here's that constructor...
> 
> Int9::Int9()
> {
>   int counter;
>   IRQnumber = 9;
>   for (counter=0; counter++; counter<sizeof(keypressed))

This loop worries me a bit. I thought the general syntax of a FOR 
loop was:

   for(initial cond.; terminating cond.; action)

which doesn't match your implementation.

>     keypressed[counter] = 0;     /* line 54 */
>   printf("About to init vars\n");
>   e0flag = e1counter = 0;
>   printf("done, returning...\n");
> }
> 

I also recommend using a low-level debugger to locate the source of 
bugs which are not obvious in the source code. EDEBUG32, which comes 
with the DJGPP distribution does the job nicely, however I would 
really recommend Ladybug V1.02 - a well arranged full-screen debugger.


Regards, Ron.



 ********************************************************************
 | Author.............. Ron Grunwald                                | 
 | Internet............ r DOT grunwald AT cowan DOT edu DOT au                     |
 | Phone............... (09)273 8027 or (09)273 8468                |
 |------------------------------------------------------------------|
 | Department.......... Computer Operations and Systems Management  |
 | Division/Faculty.... Information Technology                      | 
 | Institute........... Edith Cowan University, Churchlands         | 
 | Location............ Perth, Western Australia                    |
 ********************************************************************
 "I don't have any solution but I certainly admire the problem!"


- Raw text -


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