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 X-Sender: eliz AT is To: Nirvana cc: djgpp AT delorie DOT com Subject: Re: Breakpoints crazy? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.