This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Single stepping a simple C-program, but...



On Mon, 19 May 2008 16:28:47 -0400, Daniel Jacobowitz <drow@false.org>
wrote:
> On Mon, May 19, 2008 at 10:18:36PM +0200, Peter Toft wrote:
>> Why does the second "step" i.e. "s" take me BACK to line 7 after I have
>> been in line 8????
> 
> Probably because you compiled with optimization on.  The compiler
> scheduled part of the call before the if was finished.
> 
> --
> Daniel Jacobowitz
> CodeSourcery

Hi Daniel

Do you mean that since I have (assume A and B are two expressions - where A
is true)

if ( A || B)
  do XYZ

then I go "A" -> "XYZ" -> and now "B" -> done

rather than the more obvious alternative that I go "A" -> "XYZ" -> done
since "A" was true then "B" is never evaluated.

This seems to be a sloppy compiled code or what? 
Are there good reasons for this generated code?

Best


-- 
Peter Toft, Ph.D. [pto@linuxbog.dk] http://petertoft.dk
FÃlg min Linux-blog pà http://www.version2.dk/blogs/petertoft


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]