delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/24/01:45:34

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Sun, 24 Mar 2002 08:44:30 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Breakpoints crazy?
In-Reply-To: <3C9D0617.69890CE3@yahoo.com>
Message-ID: <Pine.SUN.3.91.1020324083735.4102H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 23 Mar 2002, CBFalconer wrote:

> Probably because optimization has rearranged the code.  Just turn
> it off (remove the -On compile flag, for whatever n you are using,
> probably 2).  Put it back when you are satisfied.

It's IMHO a bad idea to turn off optimizations when debugging a program.
Compilers these days do such complicated code changes when optimizing 
that you are effectively debugging a very different program.  So you 
either need to debug the program twice, first without optimizations, then 
with them (and who has the will power and resources to do that?), or use 
untested program when you turn on optimizations for production version.

Debugging optimized code takes some getting used to, but once you are 
there, it's not such a hard thing to do, especially with a powerful 
debugger such as GDB (RHIDE's debugging engine is based on GDB).  FWIW,
I miss this possibility badly when I work on some systems, such as 
Solaris, where the native compiler doesn't allow to mix debugging and 
optimization switches in the same compilation.

- Raw text -


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