This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Who's insane: gdb or I?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm busy trying to hunt down a problem with INN (2.3.3), and at one point 
I thought I might have found a compiler bug.  But nooo... (more below)

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        }
1086
1087        if (av[1] != NULL)
1088            Reply("%d %s fields follow\r\n", NNTP_OVERVIEW_FOLLOWS_VAL, av[1]);
(gdb) print OVERtime
$26 = 0
      ######### I can understand this if OVERtime is still in a register...
(gdb) print etv
$27 = {tv_sec = 1025700128, tv_usec = 739014}
(gdb) print etv stv
A parse error in expression, near `'.
(gdb) print etv, stv
$28 = {tv_sec = 1025700032, tv_usec = 32372}
(gdb) print etv
$29 = {tv_sec = 1025700128, tv_usec = 739014}
(gdb) print stv
$30 = {tv_sec = 1025700032, tv_usec = 32372}

objdump -S nnrpd of the relevant part:

    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

Which all seems fine.

Why did gdb tell me that the "OVERtime+=..." part happened several times
over?  A bad interaction with CFLAGS="... -O2 ..."?  Still, there are no
jumps in the generated assembly...  And why would gdb's idea of the
"current" line-number cycle between 1083 and 1084?

Bernd Jendrissek

- -- 
berndj@users.sourceforge.net is probably better to bookmark than any
employer-specific email address I may have appearing in the headers.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9Ivjt/FmLrNfLpjMRAhK2AJ9Lb7wjqA1Oj4V2CS9JWrF7n1DavwCfSt55
sgKfxWFsdH++XtlnjRS350A=
=u+rm
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]