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

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Sun, 24 Mar 2002 08:37:24 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Nirvana <nir_vana AT libero DOT it>
cc: djgpp AT delorie DOT com
Subject: Re: Breakpoints crazy?
In-Reply-To: <Oh6n8.62328$%g7.1987589@twister2.libero.it>
Message-ID: <Pine.SUN.3.91.1020324083015.4102G-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, Nirvana wrote:

> Someone can explain me why if i run this procedure with some breakpoints it
> seem to go here and there without any apparent reason? It jump some lines,
> then come back, the it invent some cycles and repeat several times the same
> instruction and so on.

Probably because of optimizations.  It's normal. 

For best results, make sure you are using the best debug info possible 
(compile with -gstabs+ or -ggdb3).  Finally, be sure to use the latest 
version of RHIDE, since the debug engine needs to be the newest one to 
work well with serious C++ programs.

> If i add some watches it simply tell
> me "not available" or VERY strange values, meanwhile the same variable,
> checked with a printf() not only is available and declared but also is
> initialized at the correct value.
> (I'm referring to the varibles initialized in the INIT PERCORSI and INIT
> VARIABILI section)

It's possible that those variables are not yet initialized when you try 
to print their values, or are in registers.  Usually stepping a few more 
lines, then printing the variables again will do.  With register 
variables, there's a command that tells in what register is the variable 
held, and once you know that, you can simply print the value of the 
register instead.

As for "not available", it's possible that the compiler optimized the 
variables out of existence.  You could either deduce the missing values 
from other related variables, or, as a last resort, declare the variables 
`volatile' to prevent optimizations.

- Raw text -


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