Date: Sun, 30 Aug 1998 18:58:30 +0300 (IDT) From: Eli Zaretskii To: Endlisnis cc: djgpp AT delorie DOT com Subject: Re: Am I retarded -or- Why is my exe size so big?!? In-Reply-To: <35E96DE1.76D4B53B@unb.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sun, 30 Aug 1998, Endlisnis wrote: > Well, I run everything through RHIDEv1.4, and for some reason, the debugger > won't touch my code. It just skips right to the end. And even if I convince > it to walk through parts of my code, I can't watch half the variables. When > I'm in the correct context for that variable, it still says "Not Avaiable". Oh, sorry, I misunderstood your original message, then. I thought that you were telling that the programs actually behave differently (i.e. produce different results) with -O2. Having the optimized program behave differently under a debugger is normal. Usually, I don't have any problems debugging such programs, though, even if some variables are optimized into oblivion, since you can use other variables to compute the values of those which aren't there. IMHO, these problems are not reason good enough to avoid optimizing, since GCC without -O produces *awful* code. You won't believe how bad is that code until you look at it. > This is a shortend version of code that needs to get data from an SVGA > function that returns SEG:OFFSET info and I need to convert it to a linear > address. Don't do that. Whenever you have SEG:OFF pair, declare two unsigned shorts (first the offset, then the segment) and compute the linear address with seg*16 + offset. I could post a lengthy explanation why your code doesn't (and shouldn't) work, but the upshot is that you should *never* try to use real-mode pointers as if they were normal C pointers. Declaring two shorts instead of one pointer forces you into correct usage (and if you don't, the compiler will yell bloody murder until you do).