From: Daniel Jacobowitz <drow@mvista.com>
To: gdb@sources.redhat.com
Subject: Re: gdb shows source line multiple times before executing !!
Date: Thu, 24 Jul 2003 15:20:00 -0000 [thread overview]
Message-ID: <20030724151959.GA7423@nevyn.them.org> (raw)
In-Reply-To: <Law11-OE25uNYhxjtX500002f7a@hotmail.com>
On Thu, Jul 24, 2003 at 08:21:02PM +0530, mohanlal jangir wrote:
>
> > Because GCC splits the code for the line into multiple parts. Part of
> > the line has executed when you step over it, but it may not be
> > immediately obvious how. For instance, given:
> > a = b + c;
> > the first time you step over it may load b and c from memory; the
> > second time may add them; and only the third will store the result into
> > a.
> hmm... but sometimes it behaves even worse. For example there are two lines
> a = b + c;
> d = e + f;
> then first gdb shows line a = b + c; then d = e + f and then again a = b +
> c. And while showing d = e + f first time if I try to print value of a, it
> will be some uninitialised (that indicates that a = b + c has not been
> executed). Then on next "next" command I will see line a = b +c again and
> then valute of a will be correct one.
Then there's some other cleanup to be done that the compiler hasn't
finished with yet. I recommend either not worrying about it, or
looking at the assembly to understand what's going on.
>
> > > mohanlal jangir wrote:
> > >
> > >While single stepping with gdb, quite frequently I see sorce lines
> > appearing
> > >multiple times i.e. gdb shows some line that will be executed on command
> > >"next", but that is actully not. After next "next" command, I see same
> > line
> > >appearing. This happens two or three times and then finally that line is
> > >executed.
>
>
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-07-24 15:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-24 14:28 mohanlal jangir
2003-07-24 14:39 ` Nikola Kolev
2003-07-24 14:44 ` mohanlal jangir
2003-07-24 14:48 ` Daniel Jacobowitz
2003-07-24 14:56 ` mohanlal jangir
2003-07-24 15:17 ` Nikola Kolev
2003-07-24 15:20 ` Elena Zannoni
2003-07-24 15:20 ` Daniel Jacobowitz [this message]
2003-07-24 15:53 ` Doug Evans
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=20030724151959.GA7423@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb@sources.redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).