Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Peter Toft <pto@linuxbog.dk>
To: gdb@sourceware.org
Subject: Re: Single stepping a simple C-program, but...
Date: Tue, 20 May 2008 07:19:00 -0000	[thread overview]
Message-ID: <0011f2e53686ecab5b25c90abecfdcb0@petertoft.dk> (raw)
In-Reply-To: <20080519202847.GA29196@caradoc.them.org>



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


  reply	other threads:[~2008-05-20  7:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-19 20:19 Peter Toft
2008-05-19 20:39 ` Daniel Jacobowitz
2008-05-20  7:19   ` Peter Toft [this message]
2008-05-19 20:48 ` Pedro Alves
2008-05-19 22:39   ` Pedro Alves
2008-05-20  7:11     ` Peter Toft
2008-05-20 11:05       ` Pedro Alves
2008-05-20 18:33     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0011f2e53686ecab5b25c90abecfdcb0@petertoft.dk \
    --to=pto@linuxbog.dk \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox