This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Who's insane: gdb or I?
- From: "Kris Warkentin" <kewarken at qnx dot com>
- To: "Eli Zaretskii" <eliz at is dot elta dot co dot il>, "Bernd Jendrissek" <berndj at prism dot co dot za>
- Cc: <gdb at sources dot redhat dot com>
- Date: Wed, 3 Jul 2002 09:41:00 -0400
- Subject: Re: Who's insane: gdb or I?
- References: <Pine.SUN.3.91.1020703162042.22873B@is>
> On Wed, 3 Jul 2002, Bernd Jendrissek wrote:
>
> > Why did gdb tell me that the "OVERtime+=..." part happened several times
> > over?
>
> Because compiler optimizations move code around, so that the machine
> instructions generated for those two lines are interleaved.
>
> Simply get used to this. I usually wait until the line shjown by GDB is
> after the one I'm interested in, and then print the relevant variables.
I get this all the time too so I usually debug code compiled without
optimization. Unfortunately if you're chasing an optimization bug all bets
are off and, like Bernd said, you just have to get used to it.
cheers,
Kris