public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* execution does not run in the source line's order
@ 2012-08-11  3:14 rivers horse
  2012-08-11  6:24 ` Jan Kratochvil
  2012-08-11  6:31 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: rivers horse @ 2012-08-11  3:14 UTC (permalink / raw)
  To: gdb

hi,
     I  debug gdb using itself,  i find  a strange  issue  :
              the programme  being  debugged  execute  not in line
order,for example,  it goes into  line 20,then it goes  into line 18 ,
    which are simply assignment operations,

    what is the reasin for this?

thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: execution does not run in the source line's order
  2012-08-11  3:14 execution does not run in the source line's order rivers horse
@ 2012-08-11  6:24 ` Jan Kratochvil
  2012-08-11  6:31 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2012-08-11  6:24 UTC (permalink / raw)
  To: rivers horse; +Cc: gdb

On Sat, 11 Aug 2012 05:14:41 +0200, rivers horse wrote:
>      I  debug gdb using itself,  i find  a strange  issue  :
>               the programme  being  debugged  execute  not in line
> order,for example,  it goes into  line 20,then it goes  into line 18 ,
>     which are simply assignment operations,
> 
>     what is the reasin for this?

You have probably compiled the file with -O2, use/force -O0 (gcc options).


Regards,
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: execution does not run in the source line's order
  2012-08-11  3:14 execution does not run in the source line's order rivers horse
  2012-08-11  6:24 ` Jan Kratochvil
@ 2012-08-11  6:31 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2012-08-11  6:31 UTC (permalink / raw)
  To: rivers horse; +Cc: gdb

> Date: Sat, 11 Aug 2012 11:14:41 +0800
> From: rivers horse <horserivers@gmail.com>
> 
>      I  debug gdb using itself,  i find  a strange  issue  拢潞
>               the programme  being  debugged  execute  not in line
> order,for example,  it goes into  line 20,then it goes  into line 18 ,
>     which are simply assignment operations,
> 
>     what is the reasin for this?

Compiler optimizations are known to reorder code, if doing so cannot
affect the result.  If your GDB is compiled with optimizations, that's
the reason.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-11  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-11  3:14 execution does not run in the source line's order rivers horse
2012-08-11  6:24 ` Jan Kratochvil
2012-08-11  6:31 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).