Mail Archives: djgpp/2002/03/24/01:39:57
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 -