delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/30/11:59:06

Date: Sun, 30 Aug 1998 18:58:30 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Endlisnis <s257m AT unb DOT ca>
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: <Pine.SUN.3.91.980830184718.20257B-100000@is>
MIME-Version: 1.0

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).

- Raw text -


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