From: Bernd Jendrissek <berndj@prism.co.za>
To: gdb@sources.redhat.com
Cc: carlo@alinoe.com
Subject: Re: Who's insane: gdb or I?
Date: Fri, 05 Jul 2002 03:05:00 -0000 [thread overview]
Message-ID: <20020705120451.B20820@prism.co.za> (raw)
In-Reply-To: <20020703151547.A28413@prism.co.za>
On Wed, Jul 03, 2002 at 03:15:47PM +0200, Bernd Jendrissek wrote:
> 1083 OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084 OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) s
> 1083 OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084 OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) s
> 1083 OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084 OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) list
> 1079 return;
> 1080 }
> 1081 if (PERMaccessconf->nnrpdoverstats) {
> 1082 gettimeofday(&etv, NULL);
> 1083 OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> 1084 OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> 1085 }
I then wondered why gdb hops between lines 1083 and 1084 a few times.
> if (PERMaccessconf->nnrpdoverstats) {
> 804cb25: a1 e8 9b 06 08 mov 0x8069be8,%eax
> 804cb2a: 83 78 74 00 cmpl $0x0,0x74(%eax)
> 804cb2e: 74 48 je 804cb78 <CMDxover+0x15c>
> gettimeofday(&etv, NULL);
> 804cb30: 83 c4 f8 add $0xfffffff8,%esp
> 804cb33: 6a 00 push $0x0
> 804cb35: 8d 5d d0 lea 0xffffffd0(%ebp),%ebx
> 804cb38: 53 push %ebx
> 804cb39: e8 b6 d9 ff ff call 804a4f4 <_init+0x780>
> OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> 804cb3e: 8b 45 d8 mov 0xffffffd8(%ebp),%eax
> 804cb41: 8b 4d d0 mov 0xffffffd0(%ebp),%ecx
> 804cb44: 29 c1 sub %eax,%ecx
> OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> 804cb46: 8b 45 dc mov 0xffffffdc(%ebp),%eax
> 804cb49: 8b 73 04 mov 0x4(%ebx),%esi
> 804cb4c: 69 c9 e8 03 00 00 imul $0x3e8,%ecx,%ecx
> 804cb52: 29 c6 sub %eax,%esi
> 804cb54: bb d3 4d 62 10 mov $0x10624dd3,%ebx
> 804cb59: 89 f0 mov %esi,%eax
> 804cb5b: f7 eb imul %ebx,%eax
> 804cb5d: 03 0d b0 9b 06 08 add 0x8069bb0,%ecx
> 804cb63: c1 fa 06 sar $0x6,%edx
> 804cb66: 89 f0 mov %esi,%eax
> 804cb68: c1 f8 1f sar $0x1f,%eax
> 804cb6b: 29 c2 sub %eax,%edx
> 804cb6d: 01 d1 add %edx,%ecx
> 804cb6f: 89 0d b0 9b 06 08 mov %ecx,0x8069bb0
> }
> 804cb75: 83 c4 10 add $0x10,%esp
I am happy with the explanation that I should get used to this when running
optimized code under gdb. With a look at the assembly (disassembled from
the actual binary) I can convince myself that the alternation between lines
1083 and 1084 is due to fancy instruction scheduling and strength reduction
on gcc's part. (gcc 2.95.2 BTW, and I know it's ancient. But it works.)
Thanks to all who looked at this. Unless anyone else thinks there's
something wrong here, I'm not too bothered about it. At -O2 I think I
deserve to be confused by gdb! :)
Carlo, do you still want me to look at -gstabs vs. -gdwarf?
bernd
--
berndj@users.sourceforge.net is probably better to bookmark than any
employer-specific email address I may have appearing in the headers.
next prev parent reply other threads:[~2002-07-05 10:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-03 6:16 Bernd Jendrissek
2002-07-03 6:24 ` Eli Zaretskii
2002-07-03 6:42 ` Kris Warkentin
2002-07-03 9:29 ` Carlo Wood
2002-07-05 3:05 ` Bernd Jendrissek [this message]
2002-07-05 18:23 ` Who's insane: gdb or I? (Answer: I am) Bernd Jendrissek
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=20020705120451.B20820@prism.co.za \
--to=berndj@prism.co.za \
--cc=carlo@alinoe.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